Circuit

This is what the circuit looks like.  It's a very simple design, requiring few parts.

At the center of this project, is an Adafruit Trinket 5v. You could substitue for a Trinket Pro or even a Feather. Anything larger probably won't fit in the case. But, if you are creative, go for it!

 

Pins 0 and 1 are used to turn on/off the loading mechanism and the acceleration engine. Since the motors draw a considerable amount of power, we have to use a power transister to switch the load so it pulls directly from the battery.  If you connect the motor directly to the Arduino pins, you will get a visit from the blue smoke monster.

In many cases, people will use an NPN transister for switching loads. In fact, I started out that way, and found out quickly that the specs on the 2N2222 are about 700mA, and the motors want more than that. So, I swapped out the 2N2222 for a TIP120 that can supply between 2 and 5 Amps. Just what the motors need for speedy operation.

The 1N4001 diode is installed to drain off any power that might be generated when the motors slow down or stop. Since there is a huge rush of electons to start the motor, they need somewhere to go when the motor starts acting like a generator and is creating electricity. If too much were to build up, we could fry the TIP120 or the Arduino interface. Always use the diode with inductive loads (motors, solenoids, relays -- anything with magnets).

Couldn't you just use a relay to switch the load?

Yeah, sure, but this project called for multiple motor speeds. A relay would just turn the motor on full blast and then off. We are using PWM, or Pulse Width Modulation to control the speed of the motor. Since the TIP120 can turn on and off very quickly, it works perfectly to turn it on and off very quickly and control how fast the motor turns.

Moving down to pins 2,4, and 5 is where is gets a little tricky, and why I had to add the programming switch.

The Trinket shares pins 4 and 5 with the USB port. If you attempt to program it and the 10k resisters are pulling the data lines high, your computer can't program it. The programming switch simply removes the 5v power to those resistors, and the USB port is able to function normally.

Pins 3 and 4 are used for the trigger and speed switches on the blaster assembly. They are pulled high by those 10K resisters via the programming switch. (programming is when the switch is open).

Pin 2 is the NeoPixel data pin. It connects through a 10k (some people use a 4.7k and that should be fine) to the DataIn port on the first NeoPixel.  Look at the NeoPixel Uber Guide for more tips on using NeoPixels. https://learn.adafruit.com/adafruit-neopixel-uberguide/overview

Power and Ground also need to be connected to the NeoPixels with a 1000uf Electrolytic capacitor to smooth out the power. This is especially important becase of the motor noise in the circuit.

This guide was first published on Apr 25, 2017. It was last updated on Apr 25, 2017. This page (Circuit) was last updated on Jul 15, 2019.