Please consider registering

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —


— Match —


— Forum Options —


Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
DC Servo robot controller based on 86Duino
2018 年 01 月 12 日
Forum Posts: 50
Member Since:
2015 年 02 月 11 日

A Delta robot using Closed loop DC brushed motor (CL4070) and quadrature decoder. Currently tuned as 3D printer.
Only picture will be uploaded, and I will make a video if I have time.

The robot will be showing in Bangkok Maker Faire 2018. (Planning to print food instead of plastic).

P 20180112 181009 1
P 20180112 181047 1
P 20180112 181245 1
As you can see there is an embedded board controlling DC Servo.

I have designed a robot controller board using SOM-128-EX (in 86Duino ONE mode). The reason I have to start over from SOM-128-EX instead of 86Duino ONE is because one of MCM pin in 86Duino ONE is hidden (a pin used for generate PWM to attach interrupt).

This board features are
1. Drive upto 6 DC Brushed motor (currently capable of 24V 13A continuous with 30A peak, Can be upgraded to 24V 21A 50A peak). Motor power supply are optically isolated from computing circuit, with 2 rails of power supply (3 DC motor driver per rail)
2. Read Quadrature Encoder upto 6 axis, both single ended and differential ended.

Note that I have rewrite my own version of MCM library by configure Motion Control Module into 6 PWM and 6 Encoder (Which means TimerOne and Encoder library are banned).
I would like to share the code, but there are problems with my code. And currently I am not able to write Path Planning and GCode section, so I use Arduino MEGA to generate STEP/DIR to be used as Reference Position (But Arduino MEGA understand that the robot it control is Cartesian, since I compute inverse kinematic using 86Duino).

The plan is to develop a new robot controller board and standard library for centralized closed loop servo, instead of open loop stepper. I cannot publish the code yet, as it is too much unstable and hazardous (When system freeze while closed loop is running).

I will explain how my code works.

1. The robot controller program is written as two thread, a normal thread and interrupt thread. All realtime codes run in interrupt thread while preserving arduino compatible codes in normal thread. Interrupt thread is usually implemented at 10 kHz (PWM runs at 20 kHz). The platform is still running DOS.

2. The program is written into 3 layers. Hardware layer includes low level function. Real Time Service layer utilize the first layer to create a service which includes reading all input and driving all output at constant rate (User can use the service by attaching function). Robot controlling layer utilize Real Time Service to control the robot completely, this includes closed loop control, homing and others. The Hardware and Service layers are only layers that are platform dependent, which means the whole system is portable. (The plan is to ported into 86Duino Linux system, and YES, I want to implement ROS too).

There are many problems I found and I can't solve it yet.
1. All other interrupt must not be used while my system is running. Having other interrupt may lead to system freeze when let it ran for a while (ranging from 1 minute to a whole day to freeze, unpredictable) (and it is very dangerous for closed loop system to be frozen). The interrupts which must not be used includes Programming USB (yes, even Serial is not used, USB must not be connected) and Hardware Serial (I have implemented a new Hardware Serial inside my service using Polling Mode instead of interrupt). I am still not sure of other interrupt source.
2. FPU can only be used in one thread (a normal, or a Real Time thread). If FPU is used more than one thread, it may create wrong output "occasionally". Or if it cannot be avoided, use FPU in Real Time and call io_DisableINT() everytime before use FPU in normal thread.
3. Path planning (includes jerk, acceleration). Because 3D printer must not stop while extruding, the printing path must be stored in a buffer and do acceleration calculation. I have read many 3D printer firmware but I don't understand and cannot adapt path planning into my code yet.

2018 年 01 月 12 日
Forum Posts: 50
Member Since:
2015 年 02 月 11 日

This contains template for using Hardware and Service layers of my program (not the delta robot controller because it is too difficult to read). The program setup the board as 6 DC motor driver and 6 encoder. To drive motor, simply change value of mcmService.motorPower[0]. To read encoder, read mcmService.encoderPosition[0] instead. ADC is also included in service (but still implemented in really bad way).

For those who want to implement this code...
1. DIR pins for DC motor driver is GP40-GP45 (12, 8, 41, 7, 40, 4) according to
2. PWM for DC motor driver is MP01 MP03 MP05 MP11 MP13 MP15 (or 9, 6, 5, 13, 11, 10).
3. Encoder 0-3 is the same, but encoder 4 use MP21 MP23 MP25 (29, 30, 31) and encoder 5 use MP31 MP33 MP35 (3, 32 and Z channel is not brought out).
4. Normally, pwm run at 20kHz, and service run at 10kHz, so the scaler is 2. To decrease service frequency, change the scaler

This program use pSerial1 for Hardware Serial instead of Serial1. pSerial is class for polling serial. pSerial is used to get rid of interrupt.

By connecting USB while running, system may freeze.

Forum Timezone: Asia/Taipei

Most Users Ever Online: 50

Currently Online:
2 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Dinosaur: 27

leutenecker: 13

mrZagg: 10

lukeross: 8

UIdahoCIT: 8

hippy: 8

smeezekitty: 8

tomka: 8

Ekkehard: 8

Kato Gangstad: 7

Member Stats:

Guest Posters: 0

Members: 1460

Moderators: 14

Admins: 5

Forum Stats:

Groups: 2

Forums: 10

Topics: 224

Posts: 1065

Newest Members: Fut, futkc, veista, c12468907, a0958606079, rouan, vicky, emily860118, zara860406, f80626

Moderators: Glaux: 70, uaa: 11, guigra: 16, asian55: 22, Android_Lin: 201, bcarroll: 12, cucubutter: 84, recycled-air: 12, stevemork: 16, zerozaber: 50, pongraczi: 20, George Andrews III: 56, poto: 11, garpastym: 20

Administrators: eveshih: 1, anthony: 31, viky6: 0, roboard: 135, hcl: 0