The tones and timings are as close to authentic Australian sounds heard at a real crossing, reversed engineered from a YouTube video recording (not mine, see links).Then the Green light is switched on and the chirp sound plays with the woodpecker sound following that.Finally a solid Red light completes the cycle, with a few more idle tones to follow.As I didnt want the idle tone playing indefinitely, the sound stops after three or so times.
If there is some demand for a continuous tone loop, then I may add this to the source as a flag. I use a 12v PSU for the main DC that runs the lamps connected via the relay modules. A DC-DC convertor is used to bring the voltage down to the Arduinos 5V operational level. Arduino source: The source is deliberately simple so as many people as possible could follow along. Arduino Traffic Light With Push Button Code Space OnThe major functions are defined for convenience over saving available code space on the device. This makes it super easy in case you need to adjust your relays to active HIGH instead of active LOW. I called these audio functions: playIdle, playChirp and playWoodpecker. The tones are stored in an array and play in order within a for loop that cycles through each one. Each tone lasts a very short 30ms, with a delay of 117ms between beats. This lasts a generous 10 seconds, which is frankly a lot longer than most crossings in real life. It must have happened during the cleaning reassembly of all the light components as years of sitting in the shed had build up quite a bit on gunk. The YouTube video wont be updated and hopefully wont confuse those outside of Australia thinking that we have reversed silhouettes in the wild:). This can be (and probably should be) tested independently from the CPU module. The button line is pulled high via the 10K resistor and awaits a momentary push to GND to activate. The CPU module is last to wire up, once the Power Relay Lamps have been tested separately. As the button is directly coupled to the CPU, it has to be tested together once it is all wired up. Unfortunately it not existing yet but this is the closest thing. I really like your project and I think I have skills to help you.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |