Open latest posts
motion simulator DIY community 

Revolution firmware and software for AMC1.5+1.6

Aufbau, Betrieb, Reparatur und der Entwicklung von Kontrollern oder sonstiger externer Hardware - Assembly, handling, repair and construction of controllers or external hardware.
on 15.06.2012, 13:12

Revolution firmware and software for AMC1.5+1.6

Postby CraCk on 15.06.2012, 13:12

    Alternative software and firmware for the controller board AMC1.5+1.6

1. Features of the firmware:
- Firmware is fully compatible with the controller board AMC1.5 by Thanos.

- The speed of the COM port - 115200.

- To control the motors of a 5-byte command in the format:
0x41, 0x42, 0xFF, a0, a1.

- The firmware implements two channel PWM (10 bit resolution), designed to control DC motors through a fee Tronigr's DIY Simple Dual Mosfet H-Bridge. PWM frequency - 18 kHz (18 MHz quartz).

- Bandwidth PWM 280 Hz (the period of the main program loop 3.57 ms for the 18 MHz quartz)

- The firmware uses the modified control algorithm, in contrast to a simple proportional control is used in the original firmware Thanos. More algorithm will be described below.

- To configure the firmware can use either a standard terminal program (input edit mode parameters are translated dip switch number 1 in position '0 '), or special management program - xSimCTRL.exe, supplied with the firmware.

- During operation of the controller on the LCD displays the following information (in a row for each axis control):
a given position (0 .. 255), sensor readings (0 .. 255), the level of the PWM (-1023 .. 1023), the current Kp
In this case a negative value means the PWM motor rotation in the opposite direction.

- Apply a modified algorithm of the survey feedback sensors (potentiometers). In the firmware includes software thresholds, designed as to limit the working range of the sensors, and for inverting the feedback signals, which can be important when using a Hall sensor. At the same time on the leg ARef microcontroller must be filed with the voltage of 5V.

- Partially supports incremental encoders as the feedback sensors.

2. Description of the control algorithm motors.
At each step of the control (the period of 3.57 ms), the computation of the error of positioning:
Error = SetPos - CurrSens
where
    SetPos - given the position
    CurrSens - the current value of the sensor feedback.

With the implementation of the classical algorithm P-control action is calculated by the formula:
PWM = Error * Kp
where
    PWM - the new value of the control signal output,
    Kp - coefficient of proportional control.


The modified control algorithm is implemented in this version, as follows:
PWM = minPWM + Error*KpX
where
    minPWM - the minimum level of the PWM to the motor,
    KpX - dynamically modifiable factor proportional control.

Coefficient minPWM is a constant defined by the user during setup. Setting the value of this coefficient is greater than zero may be true in the case when to start the motor is required to attach to it a high enough voltage.

The coefficient selected KpX program of the two user settable coefficients - KpLo and KpHi. Selecting one of these parameters is carried out when receiving a control command to the new provisions of the axes. In this case, first calculate the absolute value (modulus) of the difference between the new position given Pos (n) and the previous one given position Pos (n-1), and then are selected by the condition:
IF abs( Pos(n) – Pos(n-1) ) > KpTh then
    KpX = KpHi
Else
    KpX = KpLo

where
    KpTh - the threshold value defined by the user.

Thus, the large differences between the new and the previous position specified as the ratio of n-regulatory factor chosen KpHi, and for small - KpLo. This makes it possible to configure different factors in order to prevent overshoot on sharp movements of the axis, not missing in this small vibration.
Upon reaching the axis of the engine it shuts down the specified position.

In addition, to prevent the rocking axis of the non-precision positioning introduced an additional parameter that defines the "dead" zone - minD. If the deviation of the values of the sensor feedback from the given position does not exceed ± minD, the engine is turned off.
By default, the firmware, the following coefficients:
    KpLo = 40
    KpHi = 20
    KpTh = 5
    minD = 2
    minPWM = 0
Note that when setting KpLo = KpHi, minPWM = 0 and minD = 0, the modified control algorithm is transformed into a classic that is implemented in firmware Thanos.

3. Three. Parameters of feedback sensors (potentiometers)
This firmware implements the following algorithm for processing feedback signals received from the potentiometers.
For each axis of the introduction of two thresholds - SensLo and SensHi. If the sensor readings will be less than the value SensLo (or, respectively, greater than SensHi), the engine stops. And will only move in the opposite direction. Thus, the user can limit the working area of the sensor. In this case the remainder of the range of values between SensLo SensHi and converted into a scale of 0 .. 255.

With the help of the coefficients and SensLo SensHi can also of invert value of the sensor. It's enough to set the value SensLo MORE than SensHi
By default, the firmware, the following values of the coefficients for the two axes:
    SensLo = 45
    SensHi = 210
These settings allow for potentiometers with an angle of 270 ° to keep the working area of 180 °. In this work area is located in the center of the potentiometer.

If you want to "flip" the sensor, set it SensLo = 210, SensHi = 45

These policy guides are designed to prevent mechanical damage to the sensor in the "flight" through the axis of the extreme positions.

4. The use of incremental encoders
The kit includes the software version of the firmware, which supports the encoders as sensors feedback.
Encoders to be connected to port B of the microcontroller:

    PORTB0 .. PORTB1 - the first channel encoder control
    PORTB2 .. PORTB3 - the second channel encoder control

To restrict the movement of the axis should be included in the scheme of limit switches applying logic 0 level at operation on port A of the microcontroller

    PINA4 - upper switch of Channel Management
    PINA5 - the bottom of the first channel control switch

    PINA6 - upper switch of the second channel management
    PINA7 - the bottom of the second channel switch control

In connection with the firmware included in the encoder initial calibration procedure, which is run by applying 0 (button) on the leg 2 port A. The axis of the sink way down in the trailer and the program fixes the zero position.

The calibration procedure can be caused by feeding the controller messages
0x41, 0x42, 0x7F, 0xXX, 0xXX.
Encoders must be calibrated in a pair, or if at least one axis of the trailer can not be found - the controller has completed the calibration procedure. Exit - just reset the device.

The range of the encoder is configured strictly as firmware, but not in the terminal. Now for the encoder is 1024 pulses per revolution of the range of the angle - 180 °.

5. Using the DIP switches
Dip-switch number 1 (PORTB4) is designed to convert AMC in edit mode parameters using a terminal program.
When editing parameters do not need to enter a value that should not be edited. In response to a query about editing simply press the keypad. Enter to move to the next editable parameter.

Dip-switch number 2 (PORTB5) is designed to determine the mode of positioning axes at the start of the controller.
If the switch is set to "0", then when you turn on the controller will move the axis of the middle position (position = 127). Otherwise, the position of the axes when you turn on the controller will not be changed.

6.Description of program management xSimCTRL
The program is designed to receive data from the AMC Thanos with the firmware from the ALE-SOFT ver.2.0
The program allows you to generate control commands and transmit them to the controller board via RS232. As well as receiving data from the controller to display them as graphs, write a text file for further analysis.
Starting with version 2.0 of the program the opportunity to adjust rates in the firmware of the controller, which is an alternative to the use of the terminal.
The main window is shown in Fig.
Image

In fact the appointment of government is clear from their names. In the menu "Settings" to configure the COM port settings - 115200, 8, 1, no parity.

Managing a graphical representation
When pressed RMB (right mouse button) is a graphic image shift. When pressed LMB - scaling. At the same time to zoom down the need for coatings to hold the mouse left to right.
The data, trapped in ZoomBox «thrown open" to all of the window. If you hold down LMB to hold the cursor right to left, then the graph returns to its original scale.
In addition to scaling the image, you can use the mouse wheel.

Sending and receiving data
The transfer of control commands on the AMC begins after you check the box "to include the transfer of" the period specified in the "period (ms)." The user has the ability to specify the position of the axis, either manually or using a software generator, a separate controller for each axis
After you check the box "include taking" the controller goes into transfer mode "telemetry" data to the computer Check the "start recording" includes forwarding the received data to the clipboard image data for output on a computer screen. Buffer Size - or rather, the recording time is specified in the appropriate edit box.

Editing the parameters of the controller
Editing the parameters of the controller is made by introducing new values into the appropriate fields of the program. At the same time transfer the edited parameter to the controller by pressing the keypad. Enter.
The "Save Settings" is intended to make the controller commands save the new setting in the EEPROM. Retained only the data that have been transferred to the controller when editing.
Attachments
xSimCTRLv2.2eng.rar
Software for AMC1.5+1.6 (v2.2) 28.06.2012
(329.55 KiB) Downloaded 215 times
AMC16_mega644_22mHz_byALE_fix3.rar
Firmware for AMC1.6 fix3 27.06.2012
(8.92 KiB) Downloaded 178 times
Firmware v.2.1.rar
Firmware for AMC1.5 (v2.1) 20.06.2012
(32.54 KiB) Downloaded 200 times
Last edited by CraCk on 07.07.2012, 12:47, edited 44 times in total.
CraCk
full member
 
Posts: 22
Joined: 01.08.2010, 13:10
Local time: 19.06.2013, 08:49
Obtained thanks: 4
The following user would like to thank CraCk for this post
dualin, prilad, tronicgr


on 15.06.2012, 15:06
Re: Revolution firmware and software for AMC1.5

Postby tronicgr on 15.06.2012, 15:06

This looks good! Nice work! Any videos of it in action?

Also, you don't mention for what microcontroller is it for... Atmega8535 or Atmega644 ???

And it would be nice if you could port it to be used with AMC1.6 USB board... here: http://www.x-sim.de/forum/blog.php?u=101&b=21
(don't forget to register at http://www.x-sim.de and be logged in to see the link to it)

I wish I had more programming experience writing a PC interface like that too :thbup:




Thanos
User avatar
tronicgr
X-SIMER
 
Posts: 1482
Joined: 11.05.2007, 17:33
Local time: 18.06.2013, 21:49
Obtained thanks: 337


on 15.06.2012, 15:21
Re: Revolution firmware and software for AMC1.5

Postby prilad on 15.06.2012, 15:21

tronicgr wrote:for what microcontroller is it for... Atmega8535 or Atmega644 ???

For Atmega8535.

Videos will be a little later.
User avatar
prilad
full member
 
Posts: 37
Joined: 29.04.2012, 14:37
Local time: 19.06.2013, 09:49
Obtained thanks: 4


on 17.06.2012, 08:51
Re: Revolution firmware and software for AMC1.5

Postby prilad on 17.06.2012, 08:51

tronicgr wrote:And it would be nice if you could port it to be used with AMC1.6 USB board...

I think, it's possible.
User avatar
prilad
full member
 
Posts: 37
Joined: 29.04.2012, 14:37
Local time: 19.06.2013, 09:49
Obtained thanks: 4


on 19.06.2012, 08:40
Re: Revolution firmware and software for AMC1.5

Postby prilad on 19.06.2012, 08:40

I have a small request: if anyone ever tested the program, please write about your experiences. It's very interesting for me.
Thank you.
User avatar
prilad
full member
 
Posts: 37
Joined: 29.04.2012, 14:37
Local time: 19.06.2013, 09:49
Obtained thanks: 4


on 19.06.2012, 13:33
Re: Revolution firmware and software for AMC1.5

Postby tronicgr on 19.06.2012, 13:33

I would try it, but I don't have AMC1.5 board or Atmega8535 anymore. Especially the Atmega8535 are now obsolete parts!
User avatar
tronicgr
X-SIMER
 
Posts: 1482
Joined: 11.05.2007, 17:33
Local time: 18.06.2013, 21:49
Obtained thanks: 337


on 19.06.2012, 14:24
Re: Revolution firmware and software for AMC1.5

Postby prilad on 19.06.2012, 14:24

tronicgr wrote:I would try it, but I don't have AMC1.5 board or Atmega8535 anymore. Especially the Atmega8535 are now obsolete parts!

I understand. It is a pity. I thought you had left the working board AM1.5. Unfortunately, I do not have time for porting programs to AMC1.6 yet.
Also, I need some information about your new development - what type of LCD display you're using?
User avatar
prilad
full member
 
Posts: 37
Joined: 29.04.2012, 14:37
Local time: 19.06.2013, 09:49
Obtained thanks: 4


on 19.06.2012, 15:15
Re: Revolution firmware and software for AMC1.5

Postby tronicgr on 19.06.2012, 15:15

I moved from Atmega8535 years ago, and last year I made a new board (AMC644USB) that has almost all of the features of your modified firmware, but not PC GUI interface program. It has access to these properties though LCD menu and selection encoder, allowing for fast 1ms communication just for the two 16-bit position values.

The AMC1.6 I made this year is a modern version of AMC1.5, equipped with USB FTDI card for communications, ISP programming and power over USB, removing unnecessary parts and re-arranging the topology for easy connections. It runs almost identical firmware as the AMC1.5 with changes to few pins for the LCD and internal pull-ups for the DIP switches. I bet its not so difficult to change your firmware to run on ATmega644 as they are pin to pin compatible with ATmega8535.

The LCD display I use is a standard parallel 2x16 character HD44780 compatible. Its the most common display around the world and comes in all kind of backlight colors.
User avatar
tronicgr
X-SIMER
 
Posts: 1482
Joined: 11.05.2007, 17:33
Local time: 18.06.2013, 21:49
Obtained thanks: 337


on 19.06.2012, 16:10
Re: Revolution firmware and software for AMC1.5

Postby CraCk on 19.06.2012, 16:10

tronicgr wrote:The LCD display I use is a standard parallel 2x16 character HD44780 compatible. Its the most common display around the world and comes in all kind of backlight colors.

I think that the display is no longer needed. This is the program.
CraCk
full member
 
Posts: 22
Joined: 01.08.2010, 13:10
Local time: 19.06.2013, 08:49
Obtained thanks: 4


on 19.06.2012, 16:38
Re: Revolution firmware and software for AMC1.5

Postby tronicgr on 19.06.2012, 16:38

Well, I prefer to keep my electronics as much independent from PC software as possible. I guess being in robotics for so long I like more autonomous solutions.
User avatar
tronicgr
X-SIMER
 
Posts: 1482
Joined: 11.05.2007, 17:33
Local time: 18.06.2013, 21:49
Obtained thanks: 337



Next

Similar topics

Return to X-Simulator compatible hardware


Add this Thread to:
Add this page to Mr. Wong Add this page to Del.icio.us Add this page to Webnews Add this page to Icio Add this page to Oneview Add this page to Linkarena Add this page to Newskick Add this page to Folkd Add this page to Yigg Add this page to Digg Add this page to Reddit Add this page to Simpy Add this page to StumbleUpon Add this page to Slashdot Add this page to Netscape Add this page to Furl Add this page to Yahoo Add this page to Spurl Add this page to Google Add this page to Blinklist Add this page to Blogmarks Add this page to Diigo Add this page to Technorati Add this page to Newsvine Add this page to Blinkbits Add this page to Ma.Gnolia Add this page to Smarking Add this page to Netvouz

Who is online

Users browsing this forum: No registered users and 0 guests