~duncan-bayne/traffic-lights

traffic-lights is an Arduino sketch that runs traffic light LEDs based on noise level, calibrated against the background noise present at startup.
Convert orgmode README to Markdown
Update bit-rotted comment
Create a separate Makefile target for tests

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~duncan-bayne/traffic-lights
read/write
git@git.sr.ht:~duncan-bayne/traffic-lights

You can also use your local clone with git send-email.

#traffic-lights

traffic-lights is an Arduino sketch that runs traffic light LEDs based on noise level, calibrated against the background noise present at startup.

It's my first Arduino project, and has been a lot of fun (and quite educational).

Noise meter assembled

#components

I built this with an Arduino Uno, case, sound sensor module, and traffic light module. I used double-sided adhesive foam squares, cut to size, to mount the modules to the front of the case, and in turn, to mount the case to the wall.

#how does it work?

Quite simply :)

At startup, it spends some time polling the microphone to work out what a 'normal' level of background noise is - calculating the mean and standard deviation. While it's doing this, it ripples the traffic light LEDs, to make it apparent to the user that it's doing something (i.e. not wedged).

In the main loop, it compares the current noise level to the mean, and triggers the lights accordingly (yellow for 3 standard deviations, red for 6).

This is an improvement on my naive first effort, which used absolute values, and had to be reprogrammed for new environments.

#development

#installation

make clean all upload

#running tests

make run_tests

#licence

traffic-lights is licensed under the GNU Lesser General Public License.

#why the LGPL?

The GPL is specifically designed to reduce the usefulness of GPL-licensed code to closed-source, proprietary software. The BSD license (and similar) do not mandate code-sharing if the BSD-licensed code is modified by licensees. The LGPL achieves the best of both worlds: an LGPL-licensed library can be incorporated within closed-source proprietary code, and yet those using an LGPL-licensed library are required to release source code to that library if they change it.

#credits

Thanks to Twitter Emoji for the traffic lights icon.