I couldn't figure out what I wanted to do as a project, and I tried learning java and using android studio for the first time on Saturday afternoon. Before dinner on Saturday, I was looking at all the inventory for things to make something, and since there wasn't much left, I decided to use the Arduino 101.

What it does

First thing it does is take an average of 100 measurements for each of the sensors to have an initial average so that the weights of subsequent measurements would be clear to see. Then, it displays the current light level in lux on the screen, while continuing to do a cumulative weighted average of subsequent values and refreshes the average value, current value and screen every 0.2 seconds. The screen's backlight changes color near continuously, depending on how far away the current value is from the average value, green for very close (stable) and red for further away (unstable). Then, by pressing a button, you change views and now the screen displays sound level in dB, with a similar backlighting scheme that again adjusts the color according to stability. By pressing the button again, you change the scene to temperature with the same backlighting scheme. Pressing the button again puts you back at light level. Holding the button just cycles through the different scenes continuously.

How I built it

Very carefully. Using a thermristor, a photo-resistor, a sound sensor, a button, and and RGB display, I connected all the components onto a base shield and then put those on an Arduino 101. The software required 3 while loops inside of the void loop, which corresponded to each of the different scenes.

Challenges I ran into

Arduinos only return 10-bit values from analog inputs, from 0 to 1023, so I had to first convert them to voltage and then find equations online to figure out how to turn the output voltage into units of dB, temperature, and lux, which were fairly difficult to find and implement.

Accomplishments that I'm proud of

Coming up with he logarithmic equations which relate the absolute value of the difference between the average and current values to values of red and green for the backlight. I had to find the maximum logarithm of the absolute difference (keeping in mind that log(0) is undefined so if the absolute difference was 0 bad things would happen). I am also proud of implementing the equations for finding the actual ambient sound, temperature, and lux from the analog values I received.

What I learned

I learned how to use the Arduino IDE for the first time. I initially tried learning java and android studio, and some things stuck, but not much. Also, I got hand on experience in the Arduino IDE, and learned that the analog input for Arduino are basically voltages between 0 and 5 volts. Also, seeing as much of the syntax and the typing is very similar to java and C++, I think that by using the Arduino IDE I broadened my coding skills.

What's next for Temperature, Sound, and Light-sensing Arduino 101

Probably nothing.

Built With

Share this project: