Servo Motor DIY controled by Raspberry-pi to I2C
Doc/Documentationfirmware/Skecth for download to ArduinoLibrary_MotorDriver/Library to order the card Engine to install in your IDELibrary_I2C-Master_Python/Library in Python to order M-Boxes in I2C
- Reach and maintain a position (Angle) at a constant given speed
- Receive position setpoint by I2C link
- Security in case of exceeding values:
- Temperature
- Power consumption
- Blocking of the motor shaft
- Activation of the sensor (on / off) inversely to the movement in progress
- Return to normal operation once the value is below the trip threshold.
- Transmit the data following the command received by I2C:
- State
- Current position
- Value of a given analog input
- Value of registers Digital inputs
- Parameterization by I2C:
- Sending configuration
- Integration of a new configuration
- Saving / Loading Parameters in the EEPROM
Go to my tutorial Oui Are Makers
Wiring Diagram
You should import the control card library into the Arduino IDE: Sketch-> Import Library-> Add Library
Open the sketch firmware.ino
In USB connection, set the I2C address of your Mboxe to line #define SLAVE_ADRESS 0x14
You can enable debug mode to #define DEBUG false by passing it to 'true'. This will bring up the current position, setpoint position and PID calculations on a time scale in the Series monitor of your IDE. It is enough to subsequently COPY/PASTE this data in a spreadsheet and make a graph.
This graphical visualization will help you to find the best coefficients kp, kd and ki of your PID.
Details of the parameters in the document Parameter_M-BOXE.pdf
Once your construction and firmware settings have been made, connect your M-BOXE to the I2C bus.
As for power, I use an ATX molex 4P connector and a desktop power supply. It is important to separate the power supply from the motor from the Arduino power supply and the MC board.
The M-BOXE.py library in Library_I2C-Master_Python directory allows you to control your M-BOXE from the I2C bus.
Detail of registers (command) I2C in document Register_M-BOXE.pdf
The programs M-Boxe Manager TK in graphic mode or M-Boxe Manager CL in command line are implementations of this library.