Introduction: Arduino-Pneumatic Flight Simulator
I would like to thank my physics professor, Dr. Bert Pinsky, for helping me make this project successful.
I also want to thank Karl Anderson (CEO of Teco Pneumatics) for his generous donation of essential parts for our project.
In this Instructable, we will show you the steps to building an Arduino-Pneumatic Flight Simulator so that everyone can enjoy the fun of physics, robotics, and aviation.
The LifeBeam Flight Simulator is basically a motion platform that can make full rotations tilting at about 40-degrees. This is an efficient equivalent to the traditional "Stewart platform" simulator. Our simulator has same physical movements (2DOF) except it only runs on two pneumatic cylinders while the Stewart platform needs six cylinders.
The LifeBeam Flight Simulator is a full setup of equipment that runs simultaneously and collaboratively. The data is first sent from the Graphics or "Gaming PC" through a custom software program that acquires game data. The game data is scaled and converted into specific coordinates for the roll and pitch (X and Y) axis. The program sends out the final signal which is received by an Arduino (Duemilanove). The Arduino has a complex program on it that combines the serial commands and parses certain values to calculate a voltage which is then converted into PWM and sent to a low-pass filter which smoothes the PWM into analog voltage. The analog voltage is connected to a Pneumatic Valve Amplifier which controls the pneumatic cylinders to make the platform move accordingly.
This is a quick demonstration of our finished project. We have everything running and connected the simulator to a Logitech joystick to test the full movement.
Step 1: The PVC Construction
Before you can start any construction, you must have a rough idea of the construction of the simulator. We based our simulator off the classic "Joyrider". It is recommended that you purchase the PDF plans for $15 at Acesim.
Our Flight Simulator's main structure is the physical foundation of the project. It consists of a racing seat mounted on a series of schedule-40 PVC pipes. We have layered certain parts of the PVC tubing. All pipers are secured with screws. The PVC structure rests on a large wooden base, which is where the pneumatic cylinders are mounted. My simulator is different from other designs in the aspect that it uses an Arduino to control pneumatic cylinders instead of motors.
Building the Platform:
Once you've acquired and familiarized yourself with all the PVC parts, you can proceed to building the "Joyrider". The only part that you should omit is the "PVC to joystick" base. You should not install the PVC parts that connect the joystick to the seat.
There are certain parts on the plans that may be outdated. For the seat, you can either use a sturdy plastic chair, or an actual racing seat. It is important to firmly mount the seat with nuts and bolts otherwise it will risk falling off. Before you actually mount the seat, make sure your construction is symmetrical and balanced. Once you are finished, you should have a balanced platform that looks like an infant's rocking crib.
Be sure to drill holes and insert screws in your PVC connectors so that it will not fall apart. We chose to reinforce our setup by inserting galvanized steel pipes into the PVC to prevent them from bending and breaking. Once you are finished, you may build a wooden base to elevate the simulator. The base will be useful for implementing pneumatic cylinders.
Step 2: The Gaming PC
You will need a dedicated high-graphics computer. Be prepared to spend around $200-$600 to build or acquire a gaming computer. The reason you will need a gaming computer is because the Flight Simulator will run several pieces of software at the same time which includes the game and the control software.
I personally chose to build my own high-end computer for this purpose. I built my custom computer with a NZXT Source 210 case, 300-watt power supply, HIS 6770 video card, Realtek soundcard, 8GB RAM, 160GB HDD, and AMD Tri-Athlon processor. This is moderately enough computing power to run my applications with stability.
Although you don't need to have the exact same hardware, I recommend that your computer should be able to meet or exceed these specifications:
-USB 2.0 compatible with 2 or more USB ports
-250 watt or higher power supply
-A decent graphics card with at least 256mb of video memory
-Separate sound card
-At least 4GB of RAM
-A fast HDD with at lease 5GB of free space (for your game)
-AMD Dual-Core 2GHz processor or better
-Windows XP or Windows 7 (recommended operating system)
When purchasing computer parts, remember to include the mouse, keyboard, and USB extension cable. Also, you will need to connect your computer to both your projector and a spare monitor. Be sure to obtain the correct video cables to make the connection.
Step 3: The Pneumatics System
The pneumatics system is the setup that pushes and pulls the Flight Simulator accordingly. Since pneumatic control is a large topic with virtually limitless information, we are only going to explain the basics of pneumatics. After that, we will discuss the pneumatics specifically used in our project.
A generic air pneumatic system consists of an air compressor, valve(s), pneumatic cylinder(s), amplifier, and feedback module. There are different types of pneumatic cylinders. Pneumatic cylinders can also be called pneumatic actuators.
When choosing a pneumatic actuator, be aware of the bore, stroke, and rod diameter. Also, you want a double acting cylinder. It is recommended to purchase all your pneumatic parts from the same brand so that the tubing and connections will be compatible with each other.
The bore is the overall diameter (measured in inches) of the pneumatic cylinder. The stroke is the length that the cylinder can fully extend. The rod diameter is the measurement (in inches) of the shaft of the cylinder.
We chose to use an air pneumatic system with servo valves because it allows you to precisely control the position of the pneumatic rod. This is different from a regular valve, which just opens and closes.
When using a servo valve, you will also need a servo amplifier. Servo Amplifiers work as a PID controller which calculates an "error" value as the difference between a measured process variable and a desired setpoint. For example, if we had a scale of 1 through 10 and we sent a value of 8, the PID controller would first check the difference between it's current position (through feedback) and then move until there is no more difference between the current position and the setpoint.
Now, this is only a basic explanation of the PID system. If you would like more information, search YouTube for "PID control".
We know the servo amplifier controls the cylinder by sending a precise amount of voltage to the servo valve. With a servo setup, you will need a feedback module such a potentiometer or anything that gives variable feedback of the position of the rod.
Some expensive pneumatic cylinders already have feedback built in. In that case, all you would need to do is to plug in the feedback cable into your servo valve.
However, if your cylinder does not have internal feedback, you must must look at the documentation of your Servo Pneumatic Amplifier to see it's specifications. Once you know the requirements of the feedback property, you must create your own source of feedback by using a variable sensor such as an optical sensor, rotary sensor, or linear potentiometer.
Different sensors have different accuracy. You may want to research for the best sensor that suits your project.
We used two pneumatic cylinders, two servo valves, and two servo amplifiers for our Flight Simulator. This is because we plan to have each cylinder control one DOF or Degree of Freedom. In other words, we built a 2DOF system.
Step 4: Pneumatics Control Box
Now that you are familiar with the basics of pneumatics, we will discuss the specific parts we used in the project.
As we mentioned previously, you need a servo valve amplifier to run a servo valve. We enclosed both our servo valve amplifiers inside a nice acrylic box. We call this the Control System because this box contains not only the amplifiers, but a few other essential circuits that run the simulator.
Our Control System contains a 24v power supply, an Arduino microcontroller, a Low-Pass filter, and two servo valve amplifiers.
Let's explain the purpose of this circuit boards. Knowing that our main goal is to control the pneumatic cylinders, we need to find a way to communicate with the Servo Valve Amplifiers. We chose to use the Arduino as our solution to send signals to the pneumatic actuators. Although Servo Valve Amplifiers may vary from one another, they generally have similar properties.
To control one of our Servo Valve Amplifiers, we needed positive and negative voltages of 12 volts. In other words, if you sent a voltage signal of 0 volts, the pneumatic actuators would extend to their midpoint. If you sent +12 volts, the cylinders would fully extend. If you sent -12 volts, the cylinders would fully retract, and so on.
We now know that we need a positive and negative range of 12 volts. However, that voltage must be Analog voltage in a sine wave.
Because of this reason, we have two issues that obstruct us from directly using the Arduino with the Servo Valve Amplifier:
Issue #1: The voltage that Arduino gives out only has a range of 0 to 5 volts.
Issue #2: The Arduino only gives out Digital PWM voltage, not Analog.
Our solution to this problem was to create a circuit that scaled 0 to 5 volts to -12 to +12. In addition, the circuit needs to function as a Digital to Analog converter. Finally, the circuit needs to be duplicated because we have two Servo Valve Amplifiers.
We started to build a circuit that consisted of a few capacitors and resistors, serving to smooth the PWM voltage. After that, we made numerous tweaks with it, while testing the circuit with an oscilloscope. Once the voltage was stable, we used an IC chip to scale the voltage accordingly. Our circuit can be known as a custom Low-Pass Filter.
Since your model of Servo Valve Amplifier may vary from ours, you should research about the specifications that it needs to run properly.
Connecting to the Arduino
To connect your circuit to the Arduino, you only need to use 3 pins Ground, Pitch, and Roll.
The Pitch and Roll pins are defined as the two output that are used to control the pneumatic cylinders. You will declare these pins as Analog output in your Arduino programming code. Whatever pins you choose, they must be PWM.
For this purpose, we used Digital pin 9 and Digital pin 10. So we would connect the Low-Pass filter to Ground, Pin 9, and Pin 10. This will be where your 0-5 volts are coming from. Your Arduino is supposed to send the PWM voltages to the circuit you built.
Connecting the (Arduino + Low Pass Filter) to the Servo Valve Amplifier
Scrutinize thoroughly to find the connection terminals that will be taking in your control signal voltage. Observe carefully as you securely connect the grounds of the Low-Pass filters to the grounds of the Servo Valve Amplifiers. Then proceed to connect the voltage wires accordingly.
Connecting the Power Supply
Make sure you obtain a power supply that meets the specifications of your Servo Valve Amplifier. Make sure it has enough amperage and voltage to simultaneously supply voltage to both circuits. Observe the polarity and connect the power wires to both Servo Valve Amplifiers.
The Low-Pass Filter circuits should either get it's own voltage from the Arduino or from a separate power supply.
Step 5: Pneumatic Cylinders & Feedback
Now that you have the Control System ready to use, the pneumatic cylinders are ready to be mounted. Again, the type of mounting that you need will vary depending on what type/size of cylinder you have. However, your entire setup should be bolted together securely because pneumatics are strong enough to rip apart your construction if not securely mounted.
Being aware that our motion simulator would pivot, we used mounts that freely swiveled and rotated. This prevents breakage or wear-and-tear of the simulator.
We wanted our Flight Simulator to tilt 40-degrees all sides. Through simple trigonometric calculations, we were able to conclude that in order for us to achieve this, we would need approximately an 18" stroke cylinder. Our cylinder had a 1" bore connected to an iron ball-socket joint. The pneumatic cylinders rest on steel hinge platforms which are bolted on the base and the cylinder itself.
As we mentioned earlier, we used a PID control system, which needs a feedback module. We decided to connect a linear potentiometer to our Servo Valve Amplifier. The linear potentiometer is attached to the rod of the pneumatic cylinder so that it tracks the precise location of the rod.
If you decide to use linear potentiometer, be sure to handle them carefully. These components are fragile and can break easily. In fact, a one of ours were broken when we received them in the mail. To reinforce the durability of these sensors, we attached them to a transparent acrylic strip.
Step 6: Pneumatic Valves and Connections
It is essential for you to mount your valves and connections at a stable place. One of the best places to mount them could either be in front or back of your simulator. We bolted our servo valves and pressure equipment to the front of the simulator.
After everything is mounted in place, you may cut appropriate lengths of tubing to connect to your valves and cylinders. Make sure to yield extra length for the tubing because the cylinders are expected to move freely. Label your connections and valves to prevent accidental mismatch.
Insert the connectors for each servo valve. Attach the other end of those wires to the corresponding terminals on your Servo Valve Amplifier. At this point, it is necessary for you to familiarize yourself with the connections for the Servo Valves, Servo Valve Amplifiers, Feedback wires, and the PWM digital pins on your Arduino that control everything on the simulator.
Step 7: Air Compressor
The most essential yet basic need to any pneumatic setup is a pump. You will need to acquire an Air Compressor that can store a few gallons of air for an extended amount of time.
We used an 8-gallon 130 PSI air compressor with our setup. Although it is not important to buy a powerful compressor, you still want to buy a compressor with a large tank. Our simulator is able to run efficiently at only 10 PSI. However, it frequently refills itself with air every 10-15 minutes. If your tank is very large, you will not need to refill frequently.
If you are concerned about the price of buying an air compressor, look on eBay for good deals. However, if you are concerned about the reliability of the air compressor, then buy from a retail store such as Home Depot, etc.
Step 8: The Programming
As we mentioned previously, the Arduino is supposed to give 0-5 volts on two Digital PWM pins. I know that we've talked about converting this to ±12 volts, though we will only be focusing on the Arduino's capabilities for now.
You must be familiar with how to use an Arduino before doing this step. Wrong connections or programming mistakes can cause damage to the simulator or risk personal injury. Please understand that the Arduino is not used as a toy in this project.
If you are a beginner with Arduino, I advise you to do simpler projects to increase your knowledge.
The Arduino Code
Open Arduino sketchpad. We need to write a program that does the following things:
1. Accept serial input at 57600 baud (for high data transfer).
2. Parse the signals by byte.
3. Be able to convert voltages (from 0-5v) to the tenth decimal place to analog 255.
4. Do an inverse conversion to reverse the voltage command.
5. Recognize which pin to turn on the PWM signal; 'p' for pitch, and 'r' for roll.
6. Send the PWM signals rapidly and efficiently every millisecond. The less code, the better.
I am providing a basic Arduino code that allows you to manually control the Flight Simulator. Open the file and look at the first few declarations. You must modify the pitch and roll integers to the corresponding Digital PWM pin that you used.
Once you have looked through the code, compile and upload the code to your Arduino.
Step 9: Testing the Flight Simulator
When you are testing the flight simulator, make sure that everyone is at least 2 feet away from the perimeter. Do not ride on the simulator until you have tested it successfully and confirmed it's reliability.
To test the simulator:
1. Turn on the power to your Control System which powers to Servo Valve Amplifiers.
2. Turn on the Graphics Computer that we mentioned earlier.
3. Connect the tube from the Air compressor to the Simulator.
4. Make sure your Servo Valve wires are connected to the Servo Valve Amplifier.
5. Make sure your Feedback module is connected properly.
6. Plug in your Arduino via USB to the Graphics Computer.
7. Open the Serial Monitor on the Arduino Sketchpad. Select BAUD rate of 57600.
8. To test the pitch, type in commands one by one, such as: p5 or p0 or p2.5
9. To test the roll, type in commands one by one such as: r5 or r0 or r2.5
Tweaking the Simulator:
We have done very much to fine-tune the simulator for it's best performance. Much of this tuning is done by adjusting a few potentiometers on the Servo Valve Amplifier. To fine-tune the pneumatics, you must have a firm understanding on PID control. Adjusting the potentiometers on your Servo Valve Amplifier will help stabilize the speed and sensitivity of the pneumatics.
To control the Flight Simulator with a Joystick:
Using my programming skills in .NET application development, I have spent 3 days making a custom software program that allows you to get the position of a USB joystick using the DirectX API.
What does the software program do?
Basically, my software program does the following things:
1. Acquire position of a USB joystick. It returns large raw values.
2. These values get scaled to a range of 0-5 (for the Arduino), with a two decimal floating point.
3. I wrote an inverse conversion that inverts the scaled values. We need to do the inverse conversion otherwise the simulator will go the opposite way that we wanted it to go. The pneumatic cylinders are moving inwards when 5 volts is given from the Arduino. We actually want the opposite. In other words, we want them outwards when 5 volts is given.
4. The program needs to be able to communicate with the Arduino in the serial COM port at a rate of 57600 baud. I wrote a function that will allow us to connect to the Arduino.
5. The Arduino and the software on the computer will do thousands of "handshakes" every millisecond. These "handshakes" consist of back-and-fourth signals that check for the joystick's position and send commands back to the Arduino.
The code for this is fairly long and complicated, so I will be providing it for people who built their project using the exact same method. Once you have already tested your working simulator, connect your USB joystick and download the program that I provided below.
1. Extract the "zipped folder" and run Joystick.exe
If you move your joystick around, you should see the data-table in real-time.
2. The "administrative password" for the program is: instructables
Hit enter key after you type in the password.
3 . Then type in the COM port that your Arduino is located on (e.g. COM4). Hit enter key.
4. Type e and hit enter to enable joystick control. Slowly move the joystick to control the simulator.
When you want to disable the controls, type in d to disable.
Step 10: Games and Accessories
When the simulator is fully working, it's time to add accessories such as a screen and speakers.
We hooked up a DVI cable from the graphics PC to a spare projector. If you prefer getting a 3D projector, then your experience will be vividly enhanced. Also, it is important to hook up decent speakers to your setup. We used a pair of Bose speakers for our setup.
Remember, the greatest flaw in your project is usually caused by the weakest asset.
At this point, you may install and run compatible games on your Graphics Computer. Another popular program that may be used with your Flight Simulator is called X-Sim. This program is used by many people to control homemade simulators, and even professional simulators.
I hope you enjoyed this Instructable. Please visit http://lifebeam.net/flightsim for more information.