Introduction: Arduino/Easy Driver Animation Control Board
This instructable serves two purposes relative to assembly and use of an Animation Control Board (or PCB). The PCB is a spin off from my project to create an N-Scale Drawbridge that is functional and driven by an Arduino paired with an Easy Driver. This instructable is one of three covering the assembly of that drawbridge and documents the electronics aspects of the project. The other two cover assembly of the bridge and moving parts portions of the drawbridge.
The Printed Circuit Board (PCB) that I created for the drawbridge is, however, designed to be generic and applicable to other projects. As such, this instructable also documents how the PCB can be used in projects other than the drawbridge from whence it was born. The PCB is for sale on eBay here.
The PCB measures 100x70mm and can be mounted on a 3D Print that is available here. My goal was to have it host the Arduino paired with an Easy Driver while exposing a number of other Arduino pins for various supporting purposes. The rest of this instructable will present the functionality of the PCB, followed by its assembly, and concluding with its integration into the drawbridge project.
Even though I seem to be doing so...please do not support knock off's of the Easy Driver. I did not know the story behind the Easy Driver until I had bought a couple, and soldered one to the PCB, but I do now and here it is:
http://www.schmalzhaus.com/EasyDriver/
I have since purchased one of the "real things" and will use it in my next project. Same thing in regards to the Arduino Nano. The beauty of the open world is that you can buy things really cheap but there are times when you may not want to just because you can!
Step 1: Arduino Nano and Easy Driver
The two active components driving the Animation Control Board are a micro controller (Arduino Nano) and a stepper driver (Easy Driver). I chose the Nano because it is small and cheap. I chose the Easy Driver it supports micro-stepping. I do not actually need micro-stepping for the drawbridge but wanted the capability for future projects.
With micro stepping enabled a full rotation of a stepper motor can take eight times as many steps (8 micro steps per normal step). This means that a small and cheap micro stepping driver that normally only does 20 steps per rotation will do 160. This makes a big difference in how an animation will look!
Step 2: LEDs / Digital Pins
My thought was that these LEDs would be control panel status lights but they can be used for anything requiring an LED. Replace the resistor on the PCB with a wire and they will provide straight access to Digital Pins D2, D3, D4, and D5.
On the drawbridge these four connectors are used for 5V LEDs (with resistors on the PCB). Two of them present general status with green meaning enabled and red indicating a disabled state. Flashing green indicates the bridge is moving. The other two represent the state of the bridge (and it’s signal lights) with green meaning that the bridge is closed and red indicating that it is open.
Step 3: Buttons / Switches
These connectors provide a ground and access to pins D6, D7, D8, and A3 (which is configurable as D17). They can be used for buttons or switches when configured as INPUT-PULLUP. The rightmost connector can be used for analog if needed.
On the drawbridge these are used for the for the switch that starts movement, the end stop switches, and for the enable/disable switch (in that order).
Step 4: Relays, Servos, or Things Needing Power
These three connectors provide access to Analog Pins A0, A1, and A2 which can also be configured as Digital Pins D14, D15, and D16. As power is also provided these connectors can be used to trigger a relay, power a servo, or connect to other sensors or devices.
On the drawbridge one is used for a relay controlling a 12V signal light.
Step 5: Power Inputs
Two connectors are provided for power. One expects 5V for the electronics and the other for whatever voltage is expected by the stepper motor. If you have a stepper motor that runs on 5V there is a jumper that can be used to connect the stepper motor circuit to the electronics circuit. Be very careful not to leave this connected if you should change stepper motors to one requiring more than 5V of power!
Step 6: Stepper Motor Outputs
Four wires for the stepper motor. There is the option here to use an edge connector if your stepper motor is one of the larger ones that use 1.51mm spacing but most smaller motors use smaller connectors and there is no standard so you need to come up with a connection strategy that works with what the PCB provides!
Step 7: Other Configuration Options
There are several additional features that provide more flexibility for this PCB:
- Solder points are provided for unused pins on the Nano. These include the two pins used for Wire communications if you wanted to tie multiple boards together.
- Solder points are also provided for 5V power.
- A connector is provided for the Nano’s serial port including power and with the pins mapped in the same order as popular Bluetooth adapters.
- Several jumpers are also provided with jumpers J1 and J2 enabling the connection of Nano pins 12 and 13 to MS1 and MS2 (respectively) on the Easy Driver.
- There is also a jumper that connects the two positive terminals from the power input in the case where a single 5V source powers the Nano and the Stepper Motor.
- Finally, unused pins on the Easy Driver are also available through solder points.
Step 8: Assembly of the PCB - Parts
Now that we know about the PCB we can assemble one based on what is needed for the project at hand. In this case, for a drawbridge!
The parts we need are as follows:
- Arduino Nano
- Easy Driver
- Four 10k Resistors for LEDs
- Three Two Pin Jumpers
- One Four Pin Header
- One 3-Pin Screw Terminal Block Connector 5.08mm
- Ten 2-Pin Screw Terminal Block Connector 5.08mm
- One 4-Pin Stepper Driver Connector
Step 9: Solder Resistors for LEDs
The drawbridge control panel features four LEDs so four resistors are soldered into place.
Step 10: Install Nano and Easy Driver
Next we install the Nano and Easy Driver soldering both directly to the PCB. Note that the USB end of the Nano should be oriented to the edge of the PCB! You can cut headers to the appropriate size and solder them to the PCB if you do not wish to solder the Nano and Easy Driver directly to the board.
Step 11: Jumpers and Comms Connector
Now solder the jumpers and comms connector to their places on the PCB. I use blue putty to hold things in place while soldering but you need to move fast or the putty can melt.
Step 12: Complete With Screw Terminals
Finally complete with the screw terminals and whatever your solution is for connecting the stepper motor.
Step 13: Connect the Electronics
The PCB is shown tied down on a 3D Printed Platform that is simply there to help keep things neat. I am assuming this would be mounted under a table or on the back of a panel so a case is not needed.
Starting from the bottom left and moving clockwise around the PCB:
- Disabled LED (red)
- Enabled LED (green)
- Closed LED (green)
- Open LED (red)
- Move Push Button
- Open End Stop Switch
- Closed End Stop Switch
- Enable/Disable Switch
- Stepper Motor
- Power in for Stepper Motor (Not Used)
- Power In for Electronics (5V)
- Signal Relay
Some notes on the above.
- Jumpers are on to enable connection of the Nano to the MS1 and MS2 pins on the Easy Driver. Not that I am using the functionality but they were there for some experimentation
- Jumper is on to enable power sharing as I am using a 5V stepper motor.
- Handling of the connection to the stepper motor is ugly. Something to cleanup later and that you can do better!
Finally, the mount that is shown is a 3D Print that provides a tie down area for an input power supply and/or relays (or anything else you may need). In the case of the bridge I have a 12V power supply entering at the top right of the photo and feeding a voltage regulator that provides 5V to the PCB. A 12V circuit is also extended to the relay which then drives a signal light.
The sketch that runs the DrawBridge is here. The mount can be downloaded from here.
Step 14: Configuration for Rail and Maritime Signals
The electronics shown above are configured to support red/green signals for both the rail and maritime traffic. This is a test setup with LEDs on a breadboard and was used to write the Arduino script that controls the bridge.
The relay on the left is the OPEN state relay and would be used for maritime signals. The left, as we look at photo, connection will be on as long as the bridge is not fully open. This would be connected to a red signal for the maritime passage under the bridge. The right connection would be for the green signal that would be displayed only when the bridge is fully open and the end stop switch has been triggered.
The relay on the right is the CLOSED state relay and works exactly as above but for the rail crossing and response being linked to the bridge being completely closed.
Step 15: Operating the Drawbridge
If everything has been connected properly the control panel should reflect the status of the bridge and of the "enable/disable" switch. If the bridge is closed there will be a green LED lit next to "Closed" on the control panel. If not the red LED on "Open" will be lit.
If the bridge is open at all the signal light will be red otherwise it will be green.
If the bridge is not fully open the red "Open" LED will be flashing.
If the bridge is disabled then a red LED will be lit above "Disable" otherwise a green LED will be lit below "Enable".
Pressing the button on the control panel will cause the bridge to open if it is closed or close if it is open. While it is moving the "Enable" LED will flash.