Thursday, October 29, 2015

Halloween Candy Cauldron V2.1 (update,not upgrade--more of a downgrade)

I was having a problem with my candy cauldron: the Pro Trinket was resetting at random intervals, and the circuit would not resume unless I powered off and back on.

I surmised that the problem was power.  I was powering the 5V rails from the 5V pin on the Trinket. (This worked on the Uno, but maybe the Trinket doesn't put out as much current).  So, I took the 9V Vcc to the BAT and GND pins of the Trinket, then to the IN and GND pins of an LM7805 voltage regulator, and powered the 5V rails from the OUT pin on the LM7805.

All was good. No more reset.  I took the cauldron to a meeting in the morning and had fun.

Then I got greedy. The cauldron is very small, which limits the candy.  It's limited anyway, and in addition if candy is piled too high the sensor sees it and sets off sounds. Also, there was a sound problem: since the HC-SR04 sensor is ultrasonic, if the sound being played is long the sensor detects it and plays the next sound even if no one reaches in, and will continue until it gets to a shorter sound. For example: the howl is long but the cackle is short--if the randomizer selects the howl, it will play at least one additional sound until it gets one like the cackle; if it selects the cackle, it plays only that one sound. I had put in a 5 second delay to wait for the sounds dissipate, but that wasn't enough for all sounds and I didn't want to make it longer because that makes the candy grabbers wait too long.

So, I got a bigger cauldron and that worked fine--briefly. It played only one sound at a time since there is more room for the sound to dissipate. Then the problems: I do not know what happened, but it started producing static only and resetting--at first randomly and then continuously, then stopped producing sound altogether.  I thought I might have cooked the Trinket, but it doesn't work on the Uno either. The sensor is not registering, so I probably cooked my last one. According to my meter, there is a signal on the speaker pin when there is supposed to be, so I may have cooked the amp too. I swapped that out, with no success...but the amp I swapped to was the one I thought was cooked earlier but discovered I wired it wrong--maybe I really did cook it. I have more, but I need to solder on headers and a terminal block before testing.

So, I don't know if I'll be ready for Halloween.  If I get the amp to work I may invest in a retail HC-SR04 at Radio Shack while I wait for my $0.88 ones to arrive from China.

I'm not happy.