Welcome! After hearing the story about “Johnny the Sensor” please follow the instructions and photos below. Commands will be in bold and must be typed as shown. For example, don’t forget the “3” in python3 or the “.py” at the end of some files. I have done that more times than I can remember.
- First, open the terminal.
2. From the terminal move to the smartalawai folder by typing the command:
cd smartalawai (no spaces in smartalawai)
3. From here we can choose a program to run. So, type the command:
python3 read_sensors.py (python3 is used to say we want to run a program)
4. Next, call one of the instructors over to turn on your sensor with a magnet. It will then ask you what port to choose as can be seen from the picture above. You don’t need to type anything here, just press the enter key
5. Once you’ve done that a new window will open with graphs that show the data being collected in real time. Try to identify what graph(s) correlate to temperature, pressure, and light. You can use your hand to cover the sensor to see how the plot changes.
6. When you are done go back to the terminal and quickly press the “ctrl” key + “c” key together.
7. We will now run another file. Type the command:
python3 start_logging.py
8. Call the instructor over again to turn on the sensor with the magnet. It will again ask you to pick a port as shown in the picture above. Just press the enter key again.
9. Next it will ask what sampling interval you would like choose option B by typing the command:
B
10. It will then ask if you would like to wipe the memory. Type the command:
yes
After pressing the “return” key, your sensor should now be logging data (see below)
11. Now call the instructor over again and give them the sensor. The instructor will place your sensor in different environments. Such as a desert, a glacier, or the bottom of the ocean. You will need to identify which order your sensor traveled to these placed based on the data it has collected.
12. Once you get your sensor back have the instructor turn it on again. Then type the command:
python3 read_memory.py
Type “yes” and press return to stop logging.
13. Now we need to convert the data the sensor collected into values the computer can use to make graphs. So, type the command:
python3 bin2csv.py (make sure to use the number 2 in bin2csv)
14. Finally, we would like to see what the data the sensor collected looks like in a graph. To do this type the command:
python3 plot_csv.py
15. From here two new windows should open. Go to Figure 2 and analyze your data.
16. Based on Temperature, Pressure, and Light, and what you know about these environments… in what order did your sensor go to:
Good luck!!!