Skip to content

sui77/stellar-candyman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

DIY Stellar Candy Dispenser

Here comes yet another crypto candy dispenser. This one is Wi-Fi enabled, works for any asset on the stellar network and costs less than 20 EUR.

Parts

All you need is an electric candy dispenser like the one I've bought on amazon for about 11 EUR, a microcontroller and a motor driver.

We are going to use a esp8266 microcontroller, which is an excellent choice because it has built in Wi-Fi, is easily programmed with the Arduino IDE and only costs a couple of bucks. There are various esp boards out there but my favorite one is NodeMCU (you can get them for ~5 EUR at ebay or alibaba) which exposes most pins, has a built in USB interface for programming and has an ideal form factor for prototyping on a breadboard.

Since we can not power a motor directly from a microcontroller, we also need a motor driver. The L293d is one of the most frequently used integrated circuits for hobby projects. You connect it to a capable power source (batteries), to a dc-motor and to your microcontroller and that's it.

enter image description here enter image description here

Assembly and Wiring

Open the top and the bottom (screws are located under the rubber pads) of the dispenser and cut+remove all wires. The NodeMCU as well as the L293d work fine with 4.5V so we are powering them with the 3 AAA batteries from the candy dispenser itself. They won't last too long, look for 1865 Li-Ion batteries and a TP4056 battery module if you want a longer battery life. The L293ds pins are symmetric and it does not matter which side you use for connection, the other side would have been for controlling a second motor. The minus pole in my dispenser was originally wired with a red cable, you should better double check the polarity. Solder the L293d on a perfboard, wire everything as shown in the picture and simply tape it on the back of the NodeMcu.

enter image description here enter image description here enter image description here enter image description here

Software

Because I'm not aware of any existing stellar arduino sdk, I've implemented consuming the horizon payment stream http endpoint on my own. It's just a couple of lines so I'll just leave the method in the Arduino sketch for now instead of separating it into a reusable library. The example sketch (re)connects to horizon, parses incoming payment operations and runs the motor for 1.5 seconds whenever a payment was received. The motor is controlled by setting one of its pins HIGH and the other one LOW and stopped by setting both pins to LOW. If you are not familiar with Arduino, you can get the IDE here, add the esp8266 board like this and add the needed ArduinoJson library as described here.

See it in action

Everything Is AWESOME

About

Wi-Fi enabled crypto candy dispenser for stellar network.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages