The idea for this project came from the frustratingly frequent headaches that I would get during long school days spent inside staring at computer screens. To lights and the setting were really the cause of my headaches, I decided to track the light levels around me throughout the day, for however long I chose to keep track. I wanted to have an Arduino keep the digital data from sensors and I would keep a journal of my activities and subjective feeling, and these two sets of information could be compared to find any trends that might exist. Then I would put the data online for anyone to use or visualize as they pleased. The Arduino would use an SD card to store data, a Bluetooth module to communicate with my computer, and a Real Time Clock to keep track of when the sensor data was taken, even if the Arduino lost power in the process. The Arduino would be connected to a battery while I was moving around during the day, and I would charge the battery and use my laptop to power the Arduino while I was in a location to conveniently do so.
Assembly was not very complicated, but invovled several different components which each took some time to get working. First I wanted to get the sensor logger working, which meant getting an Arduino outfitted with an SD card, a Bluetooth module, and a Real Time Clock. The SD card was very simple. IMA already had a shield that I could plug into my Arduino, and there is a good llibrary that comes standard with Arduino. For my purposes, I have the Arduino delete the data file every time it sends the data to the laptop, so it only stores the data since the last upload.
The bluetooth module was a bit trickier. After spending several hours messing with it, I realized someone had reprogrammed the communication speed and that’s why my Arduino wasn’t able to communicate with it. I reset the communication speed, and everything went smoothly from there. I was using the DFRobot Bluetooth Module, so I found the programming commands from the DFRobot wiki.
The Real Time Clock was also extremely simple. I used the YwRobot DS1307, and got the Adafruit library for using it. The clock was extremely simple to use, but it only arrived the day before I presented my project so I wasn’t able to collect much data.
I also needed a sensor array, and for this I attached several Light Dependant Resistors to a pair of safety glasses to wear throughout the day. Any kind of sensor system could be switched for this, but it was the simplest sensor setup for me to get working. My setup had the LDRs serving as a variable voltage divider, each paired with a 12K resistor. The LDR-resistor pairs were all connected in parallel (connected to the same power and ground lines) but with seperate data lines coming off in connecting to the analog pins of the Arduino. Half of my LDRs weren’t working properly, so I ended up cutting them off and only using four LDRs in my final version.
On my laptop I made two C programs, one for getting the data over Bluetooth from the Arduino and the other for turning that data into a JSON file. They were cleverly named bluetooth.c and createJSON.c respectively. Then I used git to push the JSON file to github where anyone could access it. Finally, I used p5.js to create a visualization website. When I imported the data as a JSON file, I used rawgit to get the proper file typing (JSON rather than plain text).
For my manual log, I simply wrote down my location, what I was doing, what the environment was like, and the time whenever I moved to a new place. I then manually entered this data into a JSON file and uploaded that to Github.
You can find the JSON files here.
I would say the project was a success, at least as a proof of concept. At this point it would be easy to change out the sensor for any other kind of sensor, and keep logging data about oneself constantly. The particular sensors I used didn’t tell me much about my orginal problem, particularly because it differentiate between natural and artificial light, and just wasn’t very precise. I also don’t like my visualization website very much, but I considered that as a secondary project; once the data was online anybody could make a visualization of it, so there was less pressure for me to make the best possible visualization. I would also try using different wiring, and otherwise do a better job of soldering the sensors together. I think the weird sensor problems were directly related to my poor soldering job.
All in all, I was able to connect a lot of the topics and technologies that we covered in class in this project. To see some pictures and videos of the process, and to find the code, look farther down in this post.