Halloween Project 2021
Let's Make it Better. Version 3.0
Functionality
The new design functioned by the trick-or-treater pressing the button for the candy they wanted and the conveyor belt activated to dispense the candy to the ramp which would then fall in to the trick-or-treater's hand or bag. The button also updated the graph shown on the ipad. The LED lights did a chase pattern that was not tied to the buttons at all. It just cycled through the color spectrum in a loop. Also, as you may have already noticed, I ran out of white filament and replaced it with black for the nerds conveyor belt holder.
The Build
The 2021 build needed to overcome several dispensing challenges we had in 2020. The easiest one to fix was to replace the motion sensors with buttons. This would eliminate the issue with triggering the dispensing. The other main issue was that the rack and pinion system had to be too precise. I decided to instead use a conveyor belt design. The conveyor belt used a lego tank track and wheels in a housing I designed and 3D printed. Otherwise, it was very similar in terms of components to the 2019 & 2020 build, we used a raspberry pi 3 and a breadboard to connect a led light strip, 4 stepper motors and 4 buttons. The led strip ran a continuous light changing running pattern that was not tied to the buttons. For 2022 I am considering having it change based on which candy is selected. Python was used as the programming language. When you pressed the button for a given candy it activated the motor to turn the conveyor belt in the direction needed to dispense the candy, and reversed the belt after dispensing to ensure the next candy was properly aligned and also updated a google sheets chart which was shown on an ipad in the cabinet. We also printed a QR code so that, if people were interested in which candy won at the end of the night, they could take a picture of it and it would send them to the google sheet.
We continued to use the quick connects and breadboard in the design. It is great to be able to re-use the components for other projects or for next year's Halloween project. Unfortunately, the cabinet design had to change, but as you can see many of the wood parts are made from scraps of other projects. Other design changes were the use of 4 motors which was more complicated to code but allowed for individual fine tuning of each delivery belt and allowed for a more compact design. The cut out channels in the back of the display were cut where you could refill the candy easily, but wouldn't let the candy fall out the back.
This conveyor belt design was far superior to the rack and pinion 2020 system. It performed almost flawlessly all night!
The Code
Very little of the code from previous years could be re-used for this build. The motor sequences were the same as the 2020 Halloween project and the link to Google sheets was also the same. The LED strip was a last minute update to up the "wow" factor. We were coming off of the Grim Reaper design of 2020, so we couldn't let it go with a dull design. It was too late in the game to try to tie the LEDs into the pressing of the buttons, but it is a goal for 2022.
The Data

As you can see in the google sheet screenshot above, it was a close race with KitKats bearly winning. This was a very busy year with 170 trick-or-treaters.
Sources
Credit and thanks for how to link Python to Google Sheets goes to "Tech with Tim - Python Google Sheets API Tutorial - 2019" - Link to YouTube video