This repository is created to develop DC motor control using Arduino and to bridge it to Simulink Real-time (SLRT). We plan to use Arduino for motor PID, to use Roboguia for encoder reading, and to use L298N or Sabertooth as amplifiers. We plan to use Ethernet (UDP or TCP/IP) for the communication between the Arduino and SLRT.
More documentation details can be found on the wiki associated with this repo.
This repo is part of an ongoing development of a wrist.
- Doc of Ethernet shield V1, Doc of Ethernet shield V2
- test the Ethernet communication between Arduino and Matlab using streamVectorUDP.ino and test.m
- get motor current state (position, running mode, running status)
- set desired position
- Encoder Reading (sample code for Robogaia)
- Analog write option 1: (PWM set) (doc). Also, for the Sabertooth amplifier, one needs an RC filter.
- Analog write option 2: (DAC) MCP4725
- Amplifier: currently we are using Sabertooth 2x25 2007. Newer version Sabertooth 2x25 V2 should also work.
- PCB integration of 3-axes D/A channels, please refer to Seonghoon Noh's folder named Parker_wrist_DAC_board.
We use Arduino PID Library
- UDP_msgr, "UDP messenger" is a class written for script line use. It includes functions send, receiveDataMsg, and receiveStringMsg.
- run udp_send_receive/test.m to receive data from Aruino
Under development.
- Both RoboGaia and Ethernet shield need access to the Arduino SPI (Serial Peripheral Interface) library
- RoboGaia uses Arduino Pin D10, D9, D8, for SS (Slave Select) purposes for the three encoder channels, see RoboGaia spec for details
- Arduino Ethernet Shield (both V1 and V2) uses Arduino Pin D10 for SS (Slave Select), see Ethernet spec
- In the case when both RoboGaia and Ethernet Shield attempt to access D10, RoboGaia is not working.
- CONCLUSION: for now, we no longer use RoboGaia channel D10.
- Future Fix: we could change the select pin on the Ethernet shield, see the GitHub wiki, which comes from a forum post
- Update: The SS pins for the Ethernet and encoder shields are hardwired, so SS pins cannot be reassigned in the code. The solution was to connect D10 pin on the Ethernet shield directly to the Arduino by bypassing the D10 pin on the encoder shield and rerouting the D10 pin on the encoder shield to the D7 pin on the Arduino.