Introduction: Fully Automated Arduino Roller Coaster Control System
In this Instructable I will show you how to take your model roller coaster to the next level! I have loved roller coasters since before I can remember! Through the years I have watched the rides run at theme parks and learned from some professionals about how computer systems keep riders safe on roller coasters. I then implemented the concepts on my own K'nex coasters. Now after years of making I'm proud to show you how to create your own roller coaster safety control system! This will show you how to add an operators control panel that looks similar to a real roller coaster control panel. You will then learn how to implement the panel into a complete ride control system that mimics a real roller coaster running two trains. Implementing the concepts on your own model coaster should not be hard.
Why have a computer control system?
Whenever you ride a roller coaster at an amusement park from the second you leave the station to the second you return a computer is making sure that you are safe. However, it is also ensuring that the ride is operating efficiently. By that I mean things like slowing down lift speeds to conserve power and allowing multi train operation for higher throughput. The control system's number one goal is to keep riders safe. Basically its number one goal is to keep the trains from running into each other. The way the control system does this is through a system of blocks. The idea is if a train is occupying the next block do not let the next train in. This model coaster control system has the same idea. The system will not let the next train in until it knows that the next block is clear. If you watch the video above you can actually hear the lift motor stop until the train has entered the station then start back up to let the car go. This is the control system waiting for a clear block just like a real roller coaster would. This model roller coaster control system is as close as it gets to the real thing!
Step 1: What You Will Need
Arduino UNO
Arduino Mega
Raspberry Pi
Allen Bradley 800T Illuminated guarded push buttons
- 1 red mushroom E-stop push pull button
- 3 Amber
- 2 Green
- I got the push buttons on Ebay
5 Infrared Obstacle Avoidance Sensor Module for Arduino Smart Car
Sainsmart 8 channel relay module
LOTS of jumper wires and 22 gauge wire
Lego Mindstorms NXT 2.0
3 Lego mindstorms motors
Lego pneumatics system
craftsman 5 gallon air tank
Bike pump
Basketball needle
Dexter Industries Breadboard Adapter for Lego Mindstorms
Step 2: The Control Panel - Modify Push Buttons
To start your Allen Bradley 800T push buttons will come rated for either 120v or 24v you will need to modify them. I buy 5v LED's from Super Bright LED's that fit the sockets. If the buttons are originally rated for 24v all you have to do is switch out the bulbs. In the case that they are 120v you will have to remove the transformer on the bottom then solder 2 jumper wires to the terminals as shown above.
Step 3: Test Out Your Buttons
I like to test the lights inside of the buttons before I install them into the panel so just make a simple circuit to make sure the lights turn on.
Step 4: Layout Your Panel
Always have a vision as to what the board should look like so that you buy the right sized steel plate.
Step 5: Build the Box and Install Buttons
I bought a 1ft by 1ft, 1/8th inch thick steel plate then built a box around it that is approximately 5 inches tall. the box has hinges attached to the plate to allow easy access. Create a grid on top of the plate then drill holes in the grid locations where you want the buttons. Make sure that the holes are not too large for the buttons to slide through with the guards on. To install the buttons unscrew the guard then slide the button into the hole and screw the guard back on. The guard should lock the button in place. Once all buttons are in place wire the buttons up. 6 pins on the Arduino UNO should control your lights and 5 should control the input from the buttons (the two green buttons should be on one circuit). leave pins 0 and 1 open as we will use them later.
Step 6: Install Lift Motor
Connect the NXT motor to the lift using hot glue between the two axles. To connect the motor to the structure sandwich a K'nex piece between two Lego pieces. This has worked very well for me in the past.
Step 7: Install Station and Main Brake Pneumatics
As shown in the images above build the solenoid shown above to give the NXT the ability to control the cylinders. Also connect the 5 gallon air tank to the Lego system. This is done by putting a basketball needle into the Lego pipe. then putting that into the bike pump pipe. The system can operate effectively at pressures between 30 ad 40 psi. DO NOT over pressurize you can damage the valves.
Step 8: Install Sensors
Following with the theme of keeping things as close to the real thing as possible I use IR proximity switches. These operate just like inductive proximity switches. The only difference is that they can detect any material whereas inductive sensors only detect metal. Two Inductive proximity switches on the Diamondback roller coaster at Kings Island can be seen in the first image above. The IR proximity switches are how the system knows where the trains are on the track at all times. They should be placed at the beginning and end of each block. (grey lines in the diagram shown above separate the blocks). Sensors should be triggered when the trains are stopped on the final brake and station brake. a sensor should also be placed at the bottom of the lift to make sure that the train has successfully engaged the lift. Another should be placed just before the lift begins to crest so that the lift can successfully stop the train before it goes over. also there should be a sensor after the train has cleared the lift. this will tell the system that a train no longer occupies the lift. The images above show how I mounted all 5. I suggest testing each sensor placement by powering each sensor up and pushing a car in front. One green light indicates power and two indicate that the sensor has been triggered.
Step 9: Wire It Up!
All sensors run into the Arduino mega which you should mount to the base of the lift hill. Vin pins are even numbered pins between 30 and 38. Input pins from sensors are odd numbered pins 31-39.
Step 10: Wire Communication Lines Between the 3 Computers
Connect wires between the Arduino UNO and Arduino Mega for serial communication. Connect pin 0 on the UNO to pin 1 on the Mega. Connect pin 1 on the UNO to pin 0 on the Mega. Follow this tutorial to connect the NXT to the UNO http://www.dexterindustries.com/howto/connect-the-arduino-and-the-lego-mindstorms-together/
Step 11: Upload the Programs
coast uno goes on uno
train mega goes on mega
arduino connect is a robotc file for the nxt.
How it works.
Every time the mega detects a change in the status of any of the sensors it sends a letter. The UNO handles all of the ride control logic. It processes the letter that it received and decides what the ride should do. The UNO then sends an output through the I2c connection in the form of another letter. You can change what that letter is by manipulating the mtrPwr variable. Based on that letter the NXT either sets a new power on the lift, releases a brake, or engages a brake.
Step 12: First Power Up
The video above shows what should happen on startup. Basically what happens is the program performs 2 handshakes between the different computers to ensure that they are connected properly. if you do not get the amber lights to come on this means that the serial connections aren't connected correctly. If the E-stop light is on constantly this means the system is in emergency stop mode. You will have to pull up on the E-stop.
Step 13: How to Operate
The system works as close to the real ride as I could make it. The two green lights flash when you can dispatch a train. Push both at the same time to dispatch. The amber lights correspond to the station and brakes blocks. When flashing they are not occupied when not flashing they are occupied. The emergency stop can be pressed to stop everything on the track. You will notice that the left and right amber lights are on. You now have manual control of the station and main brake. Push down to disengage brake. Release and the brake should engage. during operation if a train reaches the top of the lift before a train has made it back to the station the train will stop. This is what the system is programmed to do as there is a train in the block ahead of it. Once the train reaches the final brake the final brake will automatically disengage and advance the car into the station. Once the brake is clear the lift will automatically start again.
Step 14: Add the UI
There is one last step in trying to make this control system as realistic as possible. Real roller coaster control panels have a display which shows a graphical representation of the block system. To make this for our system we will use a Raspberry Pi and a relay board. The way it works is that each relay corresponds to one of the proximity switches. the mega switches them on and off as the sensors are triggered. The relays are wired up to the GPIO pins on the Pi. The user interface that I created in python shows a basic layout of the block system for the control system we created. When a section of track is red this means that it is occupied. The UI only uses four sensors and the current status of them appear below the diagram. Red is triggered green is not triggered.
Step 15: (optional) Add a Second Lift
Solder two jumper cables to the battery terminals of the knex motor then program the lift to turn on after one sensor is triggered then turn off when the next is triggered. these motors run at a different voltage then the Arduino so I usually like to run them off of a separate 2 AA battery power supply
Step 16: Conclusion
I hope you take these concepts into your own designs and modify them to fit your own applications! Also I hope that you look at roller coasters in a different way. As you can see there are two tracks going up the lift hill. That second track is for a marble run. stay tuned as I will post an Instructable demonstrating the features of that system as well. Also how the two systems work in tandem to run a huge machine.