PublicSensors

Code

Github:

Github is a code-sharing website where we keep all the most up-to-date code associated with Public Sensors. If you are using a Public Sensors sensor kit, all the files you need are likely already loaded on your microcontroller. If you deleted any file by accident, you can download them from out GitHub site. 

If you assembled your own kit, you will need to load all the necessary code files on to your microcontroller yourself. 

Access the Public Sensors github page here:
https://github.com/publicsensors 

From the GitHub homepage, you can navigate into the folder, technically called a repository, called MicrocontrollerKits to find all the code needed for activity modules. 

To download files from the GitHub site, simple click the Green Code button and select Download ZIP

Open and unzip the downloaded folder on your computer. In the Sensors folder you will find the files you need for all of the PublicSensors activities:

  • boot.py
  • main.py
  • active_sensors.py
  • platform_defs.py
  • esp8266_i2c_lcd.py
  • lcd_api.py
  • read_temp.py (in the Temperature folder)
  • ds18x20.py (in the Temperature folder)
  • thermistor_calcs.py (in the Temperature folder)
  • read_dist.py (in the Acoustic folder)
  • hcsr04.py (in the Acoustic folder)
  • read_light.py (in the Light folder)
  • tsl25x1.py (in the Light folder)

You can drag and drop files on to your STM32 microcontroller like you would a USB drive.

Setting Active Sensors:

The active_sensors.py file tells the microcontroller which sensors to use. To use a sensor that is connected to the microcontroller, that sensor must be set to “1” in this file. For example, to use only the temperature sensor, the file should read:

To change the sensor, simply modify the file in any text editor and save. For example, to use the light sensor:

You can also operate multiple connected sensors by setting more than one sensor to 1.