- Alternative software and firmware for the controller board AMC1.5+1.6
- 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
- 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
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
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.
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.
