From X-SIM DIY motion simulator community - international wiki
Contents |
General
Features
- - 10bit (1024) motor speed resolution
- - 4 full PWM channels
- - 4 actuators/motors support
- - 4 servo signal outputs
- - 4 potentiometer/hall-sensor inputs
- - 4 encoder inputs (implemented on a second extension board soon)
- - 4 trim potetiometer inputs (for various settings or buttons for the LCD menu)
- - LCD-out
- - Supported motion control software:
- - X-Sim (USO Profiler v1.8 & v2.0)
- - BFF Motion Driver (Ian Hopper)
- - Portdrvr (Keith Daniel)
Tech specs
- - Motor 1,2 run on 9bit PWM on 23,47Khz (9bit = 512)
- - Motor 3,4 run on 8bit PWM on 23,47Khz (8bit =256)
- - Has 8 ADC channels with 10bit resolution (10bit=1024)
- - Fimware code cycle speed ~2ms
- Actually I drive the motor on 10-bit resolution! 0-511 for one direction of the motor and 512-1023 for the other direction!!! Same double resolution is used for motors 3,4 (9-bit)!
- Below you can see the layout I made to be able to follow the RN-VN2 connection standards. PCB plans are included to built this board if you want. Over this layout I’ll add the rest software features to make it able to fit to every type of motion simulator. Other PWM motor controller can be used too since they use the same basic connections (PWM, Enable1, Enable2) just different layout of the connection stripe.
Assembly
Notice: If you can't find the molex connectors or you found them in too high price, you can use pairs of simple DIP pin headers in place of the base connector or to create the data cable between avr controller and RN-VN2 motor controller. But you have to be carefull about the orientation of the connection if you plug - unplug them often. One full set of molex connectors for an AVR controller PCB, costs around 3.30 euro (14 connectors, male/female)... at least, this is the price I buy them for localy in Greece...
v1.5 Parts List
IC chips:
- 1- ATmega8535 16PI (rated on 16Mhz) (I overclocked it using a 24Mhz crystal)
- 1- MAX232 (Notice that these two max232 chips are the same, just different firm).
- 1- LM2940CT-5 (5volt power voltage regulator, TO-220 package)
- 1- TO-220 cooler (for the LM2940) prefer the one with wings up.
- 1- Crystal 24 MHz (24.000.000 hz) (For maximum PWM of freq 24Khz)
- 1- Crystal 14,7456 Mhz (14.745.600 hz) (To be used with alternate PWM freq of 13Khz)
- 1- Crystal 18,4320 Mhz (18.432.000 hz) (To be used with alternate PWM freq of 17Khz)
- 1- Crystal 22,1184 Mhz (22.118.400 hz) (To be used with alternate PWM freq of 21Khz)
- 3- Transistor BC547 (TO-92 package)
- 1- Trimmer Potentiometer 10K multiturn
- 1- ALPS button
Male Pin headers with black base (for servos and ADC ports):
- 12- 3pin SIP headers
Programming port headers:
- 1- 6pin female SIP header
- 1- 8pin female SIP header
Capacitors:
- 2- Capacitors 1000uF/16volts
- 5- Capacitor 10uF/16volts
- 4- Capacitors 100nF/100volts (they write on them “104”)
- 2- Capacitors 1.2nF (they write on them "1n2")
- 3- Capacitors 22pF/100volts (use two 22pF with crystals of 18Mhz or lower)
- 2- Capacitors 18pF/100volts (use two 18pF with crystals of 22Mhz or higher)
Pin headers with white base (for serial port, motor controller connector port, LCD port):
- 4- 3pin male & 4- 3pin female
- 2- 8pin male & 2- 8pin female
- 2- 10pin male & 2- 10pin female
Diodes:
- 2- Zener diode, 5V1, 1/2w (zener with 5volt cutoff, low currents)
- 1- Led Red
- 1- Led Green
Resistors:
- 1- Res 47K Ohm 1/4w , 1%
- 1- Res 39K Ohm 1/4w, 1%
- 1- Res 15K Ohm 1/4w, 1%
- 5- Res 10K Ohm 1/4w, 1%
- 2- Res 4.7k Ohm 1/4w, 1%
- 1- Res 1K Ohm 1/4w, 1%
- 1- Res 470 Ohm 1/4w, 1%
- 2- Res 220 Ohm 1/4w, 1%
- 1- Res 270 Ohm 1/4w, 1%
- 1- Res 10 Ohm 1/4w, 1%
IC bases for Atmega8535 and Max232:
- 40 Pin IC base (wide)
- 16 Pin IC base (narrow)
Misc. stuff:
- 1- Dip-8 switches package (4 switches)
- 4- Pin header jumpers (for use on the AVR motion controller board)
- 11- Pin header jumpers (Optional- For use on the LCD board)
- 1- L 10uH (Inductor, coil choke, in micro Henry)
- 1- Power Jack (Pick a PCB mount type, the photo shows a box mounted one)
- 2- DB9 Female angle (For serial port)
Build the AMC 1.5
Getting the PCB
At this time no one is producing the PCB's for the AMC, so you must decide whether to etch the PCB yourself or buy it etched from a company. This decision is left up to you. There are many tutorials online to show how to etch your own PCB and several companies that will etch the boards for you. A Google search helps here.
Purchase the Parts
There are several online companies that can supply the parts for this project, since the parts are pretty standard for the most part.
Some examples are:
- mouser.com
- Here is a BOM import list that you can use to automatically fill your cart.
- digikey.com
Wiring of RN-VN2 Controllers
Here is a schematic on how to do wirings for two RN-VN2 controllers to support 4 motors in the future... Only the first header in used for now.
Wiring for the Polulu Driver
If you are looking for a suitable alternative of RN-VN2 you can use this:
"Part#0708, Dual VNH2SP30 motor driver carrier"
Here is a schematic of the wirings you need to do to use the Polulu motor driver:
Its Yobuddy's design with a minor fixes on the pots connection.
Video: Setup Hyper Terminal
I prepared a short tutorial video that shows how to setup the connection with hyperterminal and the procedure of configuring the KP setting for the motors. For this tutorial I used an FTDI based USB-2-Serial adapter (from Digitus) to show that it actually works!!
I have put the video unedited on Rapidshare link so it does not loose any image quality! Please be a little patience to download it and watch it.
Alternative Motor Controller
Another solution instead of buying a ready commercial motor controller is to make yourself the H-bridges to fit them on the amp/voltage rate of your motors. Then you can build this DIY Dual simple H-bridge motor controller!
Tronigr's DIY Simple Dual Mosfet H-Bridge
Downloads
PDF version of v1.5 Parts List
Click here to download Part's List Pdf
AVR Motion Controller v1.5 Layout
- Click here to download the AVR Motion Controller v1.5 Layout pdf
- Click here to download the AVR Motion Controller v1.5 Layout - bottom only pdf
AVR Motion Controller v1.5b Layout
Click here to download the AVR Motion Controller v1.5b Layout
Click here to download the Avr Motion Controller v1.5b layout - bottom
Click here to download the Avr Motion Controller v1.5b layout - bottom filled
And in case that you already ordered a AVR motion controller v1.5 layout here is a separate extension PCB that has this extra circuitry to drive four simple H-bridges:
PWM_to_simple_hbridge_dual.pdf (121.09 KB)
PWM_to_simple_hbridge_dual_bottom.pdf (28.12 KB)
Eagle version
Sprint Version (enhanced)
Click here to download the AMC v1.5 (sprint) layout
Firmwares
v1.0
This is the first official release v1.0. It replaces all the previous beta versions! For this reason I included the code for the two motion styles (Joyrider & SimforceGT) in it, and made it selectable between them with a jumper.
I connected a simple pot on directly on the motor axis and had enough precision on positioning without much ringing. So using multiturn pots is not always necessary. You can connect two dual h-bridge motor controllers on it and control four motors but with a small restriction. The last two motor channels will run on 8bit PWM. This is a restriction of the Atmega8535, as it has only one 16bit timer that is shared on the channels for the two first motors. Anyway 8bit PWM isn’t that bad and can be used in heave or rotation that precision isn’t so critical.
Some description of the features of that Firmware v1.0 has:
- It uses only the first two motors for now: The pin header on the bottom (named rn-vn2) that can be connected to the JP1 header of an dual h-bridge motor controller.
- It uses only two the first two pots. Pot1 is position feedback for the motor1 and Pot2 is position feedback for the motor2.
- Don’t forget to align the position pots with the motor or the motion travel route to successfully have position feedback.
- When powered both motors should move to center position. If not immediately disconnect the power and reverse the motor +,- connections to turn to the opposite.
- It runs on serial speed of 115200 and you have to enter the setting of the following photo in the profiler USO to get it connected right:
The format of the output string is “AB~255~~y~~x~” The ~255~ is there for compatibility reasons to be able to also test with Ian’s BFF 3DOF driver!!
Since the AVR controller has its own serial programmer included (ISP) you can use ponyprog to easily program the flash firmware on it and set the proper fuses for the crystal speed. You can see on the bottom of this post how you can use ponyprog.
I also developed the SimforceGT (frex-like) motion included in this version for Egoexpess and everyone else with simular motion cockpit!!!
Notice: This is a coupled motion version for two motors. Meaning the two motors are cooperate to lean to sides and back-forward.
Motor assignments are as follow:
- Motor1 connection (on first DSMhb) is the right motor on the simulator.
- Motor2 connection (also on first DSMhb) is the left motor on the simulator.
- Again potentiometers are used for feedback on the motors: Motor1 --> Pot1 , #Motor2 --> Pot2
- The motion is limited in half for left-right as I reserved the rest motion capability for front-back motion!
PonyProg
In case you don't know how to program the firmware on it, here is a small guide on how to use Ponyprog2000 to program the board:
Thanos PonyProg Guide (500.13 KB)
Motion Controller Videos
FAQ
What time your current stamp will need ? (worst case one)
A. The current controller using the basic stamp2 does one complete code round every 33ms. This happens because it BS2 does not support interrupts to know when data from pc are waiting to be read. So I just run one round the code and let it wait for the next data packet. This way it synchronizes to the 33ms of the software.
The Portdrvr works even faster with 19ms update rate, so the control of positioning in flight is more smooth.
The new controller I'm preparing, that is based on AVR, will run the tasks of controlling the motors and the encoders constantly (perhaps less than 5ms in each code round) making an interrupt only when new serial data are waiting on its buffer. So it will be indepented from the 33ms refresh of the software and more accurate on positioning. And with 115kps serial communication speed will be ultrafast! To determine the actual speed I could use a toggle pin as you suggested and a frequency meter...
Which language are you using to program the AVR?
I use Bascom to program it and some pieces of assembly.
Is the source available?
I prefer to give to the public only the "coded" firmware as its personal hard work. If you need something more to add to its features, ask me and I'll try to add it too. I could even customize it to your motion sim needs if you like.
I am currently building your interface, as per your document, and I need to know if this is the same code we would use for a FSX 2DOF motion sim with a different x-sim profile using motor1 for pitch and motor2 for roll?
No, this firmware introduces SimforceGT motion with coupled motion of the motors.
For flight sims (and motion systems like Joyrider) its better to use the Beta001 firmware. It outputs 2 axis uncoupled!
Do we program the AVR with your interface board too.. (by using the dip switches?) or do I build the serial programmer from the Pony site?
Thats way I embedded the PonyProg programming circuit on the avr motion controller board! I did so, to be is easy to program it for the beginners without the need of building programmers etc...
You only need to connect a serial cable (simple extension, NOT NULL modem!!) between the PC and the the avr motion controller board and connect with wires the two programming headers. I left them unconnected in case you might want to use different external programmer to download to it the firmware.
Then you just follow the ponyprog guide I made for the rest of the procedure...
What is the ratio for the PDF's for the PCB's 1:1
Is there any specific reason the RN-VN2 or VNH2SP30 will not power 24v motors?
The RN-VN2 limits the max voltage not the VNH2SP30 it uses.
One with the proper designing knowledges could desing a new motor controller based on VNH2SP30 that can handle the max of 41volts or the 25amp. But it will be some sort of expensive to do something like that since much measures must be taken to prevent overheating and allow the VNH2SP30 to provide the 25amp safely.
Thats why the developers of RV-VN2 choosen to limit these features.
What if I can't find a dealer for the molex pin headers?
If you can't find them, its ok, you can always use the normal pin headers with black base. But then you have to be carefull for the orientation of the connector.
Is there a German supplier of the Molex Pin Headers?
Go to [Farnell.com] and search on Molex.
Do I build the serial programmer from the Pony site to program your controller board?
No, thats way I embedded the PonyProg programming circuit on the avr motion controller board! I did so, to be is easy to program it for the beginners without the need of building programmers etc...
You only need to connect a serial cable (simple extension, NOT NULL modem!!) between the PC and the the avr motion controller board and connect with wires the two programming headers. I left them unconnected in case you might want to use different external programmer to download to it the firmware.
Then you just follow the ponyprog guide I made for the rest of the procedure...
What are the 4 molex cons with 3 pins for?
The four 3 pin molex headers connect the max232 circuit to the microcontroller. For now we need only to connect a cable between the two 3-pin headers named as "RX".
This will enable the receiving of the serial data thru the "I/O data input" serial port. I connected it as seen in the following photo:
The other two "TX" headers are there for future use to send back in the computer info about the position of the motors or the rest potetiometer inputs for fine tuning during play. For Simforce sims, the max difference between the actuator positions will be adjustable by fine tunning it with a potetiometer from the rest unused pot ports.
What are the benefits of using the ATmega644 over the ATmega8538?
Some of the benefits of the Atmega644 is increased memory size and four high resolution PWM channels. And some other minor things not usefull to us. The PCB v1.5 accepts both atmega8535 and atmega644 in the same socket. I will use Atmega644 a little later as for now atmega8535 can do the things we need.
what kind of lcd can i connect to this board?
You can use any 2x16 parallel LCD that has HD44780 controller.
I finished building the board, but i was wondering about the serial connection: do i have to use a straight cable or a null-modem linked one?
You need a straight cable, also knows as "extension" serial cable.
Which Poteniometers do I buy for the output for joyrider?
You can purchase some simple 100KOhm 270degree potentiometers and add 1:3 reduction gears on their axle to be able to have them measure the 90 degrees rotation of the Joyrider on each axis.
Why are the MOSFETS IRF4905 and IRFZ44 on the 3pole connectors? Can I solder them directly to the board?
You can connect the Mosfets directly on the board, but I prefer the terminal connectors cause I can replace them easily if I burn them accidentally!!
Why is there a version of the PCB with filled ground?
There are two versions of the PCB, with filled ground and without, cause each one has its advantages. Filled Ground PCB is more immune to electrical noise, but harder to solder. If not careful enough, you can easily create a short-circuit bridge somewhere. On the other hand some prefer the no filled ground PCB layout cause its easier to develop with their own etching tools and easier to solder the materials on it.
I have a 300 degree Potentiometers, will they work?
300 degree rotation pots? Why not? But then you will need to use reduction gears of 1/3.3 ration to get close to the 90degrees of rotation of the joyrider.
Can you see any problem useing interupts for data reception, the PWM's will be output compares and independant of program run speed?
Yes, you need interrupts for the serial port as well as a decent buffer to store them until you read them. I'm using 30bytes buffer just in case.
DISCLAIMER
NOTICE TO ALL: This is still a BETA version and I’m not held responsible of any damage happens to your motors, simulator structure, you, etc. Use it on your own Risk!! You should know that motion simulators can be very dangerous if not handled with care!
Thanos
MainPage | X-SIM 2.0 Manual | Projects | Tutorials | Forum







