AMC1.6 2DOF DC motor controller:
This is the next generation of my AMC motion controller. It was long time ago that I published my first version, that went through lots of revisions and fixes all this time. This new version is all easy to make and use.
I decided to go USB all the way that means that except from using usb for communications I also use it in this board for providing power and self-programming. No need for power supplies and power regulators anymore. No need for external programming circuits, no need for Ponyprog or anything. A few jumper cables and a few clicks and you are ready to go in seconds.
Here is a short list of the new features (to be expanded):
1. I'm using Atmega644 MCU running at 18.432Mhz. Older chips are going obsolete so why bother with them?
2. a. Sparkfun FTDI USB module for serial communications @ 115kbps.
b. +5V power over the USB module. No more external power supplies.
c. FTISP (FTDI In System Programmer) provided by the USB module. This solves the chicken and egg problem
3. The LCD is attached on the main board directly. Added trim potentiometer for LCD Contrast.
4. Except of using just potentiometers for feedback, quadrature encoders will be available in firmware update really soon.
IMPORTANT CHANGE TO FIRMWARE:
Starting firmware v1.1d , there is now option to change the KP settings for the motors on the start-up of the board. The procedure is simple, turn on the AMC1.6 board, fill out the following string in the simulatorstart field: KP~255~~<Y_KP_value>~~<X_KP_value>~ or for a more detailed example: "KP~255~~4~~6~" to set KP4 for the Y motor and KP6 for the X motor.
If you wish to SAVE permanently the settings you can use ONCE the following command format:
or for a more detailed example: "KP~254~~5~~8~" to save KP5 for the Y motor and KP8 for the X motor. In this case an additional message will appear on the second line of the LCD "Saved KP Setting".
Just to note that if you stop the converter and start it again it won't try to set the KP values again until next time you cycle the power to the AMC1.6. A useful reminder is that the Flash memory of the ATmega644 cannot be overwritten more than 20000-30000 times so once to find the suitable KP setting, remove that SAVE command line from the simulatorstart field.
Below are all of the project files you will need to build it and program it.
This a simple and powerful terminal to use to for KP parameter changes.
The USB board I used is from Sparkfun:
Breakout Board for FT232RL USB to Serial
But I lately noticed cheap knock-offs on ebay:
FT232RL USB to Serial Module USB to TTL level for Arduino 2560 UNO R3 ARM A033
The USB interface is based on a FT232R chip from FTDI (http://www.ftdichip.com). This chip's primary function is to act as a USB->Serial converter, allowing the user to get serial data without requiring a standard RS-232 serial port. The USB interface can also be used to reprogram the firmware in the AVR processor using a special utility, ftisp. No USB programming knowledge is necessary to use the USB port.
The USB programmer works on the bit-banging principle. It uses some of the ports of the FT232RL chip to send the proper SPI programming commands. The firmware that is carrying the x-sim3 logo is included in the following files:
Firmware 1.1e with added 10% deadzone near the end limits of the potentiometers to save them from mechanical damages. Note that it limits the motion range to 201 positions.
Firmware 1.1f defines the range of the end limits deadzone with a potentiometer connected on pot3.
In the zip file you will find two versions of the firmware, one for crystal 22.1184Mhz and another one for crystal 18.432Mhz in case your atmega644 can't handle the overclocking and resets.
More information about firmware 1.1f on this post:
For example if you set 5%, its the limit to each direction, so if you have 180 degrees position sensor:
180/2 = 90
90 - 5% = 85.5 degrees
Total allowed degrees will be 85.5 * 2 = 171 degrees!!
Using the same concept you can reduce a 270 degrees potentiometer to 180 degrees, but you must remember that you should expect less resolution available. This function is there to do micro fine calibration not to abuse!
As the above but added a cut-off function for users to be able to turn off PWM and Direction outputs, thus setting the motor into brake. To use it just connect the "A1" pin from the encoder header to the GND through a switch. Or you can use multiple switches if you like all connected to that single pin.
Firmware v1.1h (latest)
In this Firmware v1.1h, I fixed problems with ADC noise that was affecting the potentiometer accuracy. Also the program loop speed was increased now to 9000 times per second (offline) and 7000 times per second on-line (receiving serial data).
FTDI D2XX Direct Drivers (CDM) drivers must be installed (Get drivers here: http://www.ftdichip.com/Drivers/D2XX.htm).
D2XX drivers allow direct access to the USB device through a DLL. Application software can access the USB device through a series of DLL function calls.
In these photos you can see how I attached the USB module on the old board (AMC1.5) to test it.
And here is a example video of the USB programming procedure:
Also one more thing you have to take care is to the remove the little short jumper on the sparkfun board that ties the VCCIO voltage to 3.3v. This is needed as on the AMC1.6 board I tie the VCCIO voltage to 5V !!! Its really important to do that!! Here is some photos where is it:
OR if you have the most recent version of sparkfun's board just unsolder the pad that is named "3.3" and solder the "5" one!
As you can see in the video, the new firmware now outputs a string with identification and some useful information about the position of the feedback potentiometers. The string is in the form:
AMC1611 255 1023 255 1023
Its plain text that can be captured easily with a terminal program or can be implemented easily into a x-sim plugin for graphical representation of the position of the motors. The string is sended from the AMC every 115ms to decrease the load on the Communications and leave as much free resources in the microcontroller is possible.
Motor Driver selection:
Although you can still make and use my old DSMhb1.2b from the old * site, I strongly recommend the use of more powerful and modern motor drives like the following:
Pololu High-Power Motor Driver 18v25 for use with 12v motors max ampere 25A
Pololu High-Power Motor Driver 24v20 for use with 24v motors max ampere 20A
Looking for a cheap substitute? Try these for half price of the pololu boards:
High Current Dual Motor Driver Module Board with Heat Sink
And here is the old DSMhb1.2b if you feel like making everything by yourself.
Position feedback options:
For position feedback of the motor you can use any kind of potentiometer fits your simulator type. It can be simple 270 degree or 10-turn or anything that exists out there. The potentiometer value should be in the range of 10K for best noise immunity.
Other option is to use hall-effect ratiometric sensors that they can define a 180degree rotation position by using two external magnets for reference of their magnetic flux. A nice model is the SS495A that works with 5v voltages and has almost full range 0-5v output with very little drifting.
Another possible sensor you could use for 360degree rotation is the AS5145H-HSST. It has both analog 0-5v, quadrature A-B and SPI digital interface!!
A quick demonstration of the calibration procedure of a SS490 ratiometric hall effect position sensor.
It shows how to limit the range of the readings of the sensor on the AMC1.6 board (same applies to AMC644USB)
The SS490 ratiometric hall effect sensors are a nice contactless solution for position feedback that needs only two magnets to read accurately angles from 0 to 180 degrees. This can replace potentiometers that are normally not designed for too much motion because of the friction and have generally limited life cycle.
Another possible solution would be the AS5145 Automotive Rotary Encoder IC. Positioning of the motor is done using its PWM output signal thru a low pass filter to get analog out signal. The absolute angle measurement provides instant indication of the magnet's angular position with a resolution of 0.0879° = 4096 positions per revolution.It also has SPI (serial interface) as well Quadrature A/B (10 or 12 bit) and Index output signal, that could be adapted for use in special application.
Assembly of an actual AMC1.6 board:
I finally received a PCB for this AMC1.6 project which was donated by Gilles (France) which I would like to thank very much!
The quality of the PCB is not the best around but it works, I guess I got too much spoiled by the excellent quality of my AMC644USB pcb's last year.
There is no silkscreen on the top of the board and it looks kinda empty with the long distances between the parts, so I decided to mount a silkscreen on the board using a printout on normal paper and glue it on the board using rubber cement. Worked just fine!! No wrinkles or mess as anyone would think!
So in less that 2 hours I had this assembled and programmed. All is working as expected!
So this is my "WHITE" version I guess, after choosing to make my other board AMC644USB all "BLACK"
This project is shared with all you for use in non-commercial DIY applications. If you like to use this for a commercial application please contact me.