1. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Download Package Now!
  2. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  3. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant here. Do not following these rules will lead to permanent exclusion from this website: Read the forum rules.

Revolution firmware and software for AMC1.5+1.6

Discussion in 'SimTools compatible interfaces' started by CraCk, Jun 15, 2012.

  1. CraCk

    CraCk Member Gold Contributor

    Joined:
    Aug 1, 2010
    Messages:
    52
    Location:
    Made in Ukraine
    Balance:
    729Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    2DOF



      • 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.
    [​IMG]

    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.

    Attached Files:

    • Like Like x 5
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    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 :thumbs




    Thanos
  4. prilad

    prilad Well-Known Member SimAxe Beta Tester SimTools Developer

    Joined:
    Apr 29, 2012
    Messages:
    381
    Location:
    Dubna, Russia
    Balance:
    9,089Coins
    Ratings:
    +484 / 1 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Re: Revolution firmware and software for AMC1.5

    For Atmega8535.

    Videos will be a little later.
  5. prilad

    prilad Well-Known Member SimAxe Beta Tester SimTools Developer

    Joined:
    Apr 29, 2012
    Messages:
    381
    Location:
    Dubna, Russia
    Balance:
    9,089Coins
    Ratings:
    +484 / 1 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Re: Revolution firmware and software for AMC1.5

    I think, it's possible.
  6. prilad

    prilad Well-Known Member SimAxe Beta Tester SimTools Developer

    Joined:
    Apr 29, 2012
    Messages:
    381
    Location:
    Dubna, Russia
    Balance:
    9,089Coins
    Ratings:
    +484 / 1 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Re: Revolution firmware and software for AMC1.5

    I have a small request: if anyone ever tested the program, please write about your experiences. It's very interesting for me.
    Thank you.
  7. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

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

    prilad Well-Known Member SimAxe Beta Tester SimTools Developer

    Joined:
    Apr 29, 2012
    Messages:
    381
    Location:
    Dubna, Russia
    Balance:
    9,089Coins
    Ratings:
    +484 / 1 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Re: Revolution firmware and software for AMC1.5

    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?
  9. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    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.
  10. CraCk

    CraCk Member Gold Contributor

    Joined:
    Aug 1, 2010
    Messages:
    52
    Location:
    Made in Ukraine
    Balance:
    729Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    2DOF
    Re: Revolution firmware and software for AMC1.5

    I think that the display is no longer needed. This is the program.
  11. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    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.
  12. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    Just a suggestion, Why don't you register at x-sim.de and present there this project. It will be easy for you to get a level2 key for x-sim3 with it. We really need more projects and people activity there if we wish the x-sim project to stay alive.
    Last edited by a moderator: Mar 13, 2014
  13. prilad

    prilad Well-Known Member SimAxe Beta Tester SimTools Developer

    Joined:
    Apr 29, 2012
    Messages:
    381
    Location:
    Dubna, Russia
    Balance:
    9,089Coins
    Ratings:
    +484 / 1 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Re: Revolution firmware and software for AMC1.5

    I have registered on the x-sim. But it's not only my project. This is the result of work of a small group of enthusiasts who helped develop and test software.
    I think it is fair to get the key level 2 for each of us. Is that possible? Can you help with this?
  14. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    This is matter of administrator of x-sim3... You can request it if you like there... But hurry up... in 10 days there will be no option for free level2 keys...!
  15. CraCk

    CraCk Member Gold Contributor

    Joined:
    Aug 1, 2010
    Messages:
    52
    Location:
    Made in Ukraine
    Balance:
    729Coins
    Ratings:
    +17 / 0 / -0
    My Motion Simulator:
    2DOF
    Re: Revolution firmware and software for AMC1.5

    Why now so difficult to get a license key? I would like to that x-sim for home users was completely open. Will soon x-sim is completely commercial? :(
    Unless it can be called autonomous decision Image Data? On display we get much less information than the program!
  16. prilad

    prilad Well-Known Member SimAxe Beta Tester SimTools Developer

    Joined:
    Apr 29, 2012
    Messages:
    381
    Location:
    Dubna, Russia
    Balance:
    9,089Coins
    Ratings:
    +484 / 1 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
  17. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    When I started building the AMC, there was no way to send data to PC for such software. It was still x-sim version 1.6...!!!! I had to use the LCD for the calibration of the sensors and make sure it was receiving data, etc...

    But this is really cool! You don't need the LCD this way! Well done!
  18. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    If there isn't enough interest for free software yes. It was supposed to have some users from the community beta test it with games, write manual, build projects with it, but in the end there is no desire for such thing from the users. Making it commercial will support only the rightful owners of the software.

    I wasn't meaning this for the AMC1.5, but for my new AMC644USB that has LCD menu with all option and settings available to set them on the fly while its still connected to x-sim and moving the motors... Its build was influenced by my other robotics projects. See it here: http://motionsim.blogspot.com/
  19. prilad

    prilad Well-Known Member SimAxe Beta Tester SimTools Developer

    Joined:
    Apr 29, 2012
    Messages:
    381
    Location:
    Dubna, Russia
    Balance:
    9,089Coins
    Ratings:
    +484 / 1 / -0
    My Motion Simulator:
    3DOF, DC motor, Arduino
    Re: Revolution firmware and software for AMC1.5

    This is a compilation for AMC1.6 (for ATmega644). Unfortunately I can not test the firmware with hardware except for the debugger Avrstudio. But I set all atmega644 pins in accordance with the scheme of your AMC1.6.

    [attachment removed. Look fixed firmware in next messages]

    I think you should first check the firmware without power devices. And check control signals by oscilloscope.
  20. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    I'll give it a try as soon is possible, given I'm working the weekends...

    Thanks!
  21. tronicgr

    tronicgr

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
    Re: Revolution firmware and software for AMC1.5

    Hi,

    I did a test on it... pretty disappointed... :?

    I can't get it connected to x-sim, can't even get it connected to your software even if I set the comport settings right.

    Another thing is that the analog feedback (potentiometer) is jumping around like crazy. I took a video to show you the difference with my original firmware and yours. I left everything connected and then just loaded your firmware to show you the difference...

    http://www.youtube.com/watch?v=bOP9lSmDzdM

    My thoughts... Needs work still!!


    Thanos