2 Attachment(s)
DIY AC Servo Drive - ATMega based
Hello dear machinists!
A long time ago I tried to build my own servo drive (and I almost did), based on ELM CHAN Servo drive schematics and code.
I am now building an AC servo drive from scratch. I have my own program, and my own schematic.
After a couple of weeks of hard working, reading, soldering and programming this is what I obtained:
A cheap servo drive, based on ATMEGA644 (lower versions can also be used as compiled program hardly occupies 15% of MCU flash).
The whole boar wont cost you more than 30$!!!
The features so far:
Works with AC motors without using any Hall sensors.
Step / Dir inputs
UART connection for tuning and debuging
I can tell you that I am really happy with the performance obtained so far. My own build servo (a cdrom motor and an optic encoder from an old mouse) works really fine. I was able to obtain about 1200 RPM with this 6 poles motor and 90 PPR encoder.
Little software / hardware description.
MCU must have 6 pwm outputs and 3 external interrupts.
3 x IR2101 are used for driving the final stage mosfets.
1 x 74hc14 is used to buffer my encoder inputs.
16 Mhz clock on MCU (can be raised to 20 Mhz)
PID process for controlling movement.
I will make the schematic and source code available for anyone here. Please feel free to modify them as you need (they are not under any kind of licensing)
Here are some pictures and video of my very beta board and servo!
https://www.youtube.com/watch?v=Auw7-5yBa3o
1 Attachment(s)
Re: DIY AC Servo Drive - ATMega based
Here is the firmware and schematic as promised.
Program is compiled with Mikropascal Pro for AVR.
Schematic and board are done in Eagle 5.8.0.
I am a software engineer so please forgive my mistakes in the schematic.
I am open to any suggestion or remark!
I will come back later explaining functionality and where and how the PID process is involved.
Mihai.
Re: DIY AC Servo Drive - ATMega based
Re: DIY AC Servo Drive - ATMega based
Short description of software commands:
1. 'getconfig' - will display the config parameters stored in the EEPROM
example output:
CONFIG:
ENCODER PPR = 90
MAX PPR ERROR = 45
MOTOR POLES = 6
PID Kp = 450
PID Ki = 350
PID Kd = 100
2. 'set ppr XXXX' - will set the PPR rate of the encoder. XXXX must be unsigned int 16
3. 'set error XXXX' - will set the max allowed error. If during movement the EncoderPosition - DesiredPosition is greater than this value servo stops and error led is powered. This is used only when STEP/DIR commands are applied. XXXX must be unsigned int 16
4. 'set poles XXXX' - will set the number of poles of the motor. (I am not sure about this terminology, what I did is: for eg. 6 poles means the motor makes a full turn in 6 sine periods)
5. 'set kp XXXX' , 'set ki XXXX', 'set kd XXXX' - will set Kp, Ki and Kd constants of PID process calculation.
6. 'start', 'stop' - starts or stops the PID process. if stopped no power is applied to motor and PID calculation is stopped.
7. 'enc' - will display the encoder position register (Int 32 signed). PID must be stopped to allow this
8. 'move XXX'X - starts a free movement of XXXX steps. During this the max allowed error is set to max int 32 so no error will be raised during this kind of move.
Give it a try... :)
Re: DIY AC Servo Drive - ATMega based
mcm_xyz
Well done, looks like a fun project
Re: DIY AC Servo Drive - ATMega based
great ,,, :) must see more pictures and progress..
Re: DIY AC Servo Drive - ATMega based
Wow! That's nice!
Can it work with a larger motor? What would it take to support that? Can I help?
4 Attachment(s)
Re: DIY AC Servo Drive - ATMega based
First PCB!
It's milled and drilled on CNC. Not so good. The separation is very poor, parts are very hard to solder.
I will stick to old chemical way for the next versions and maybe drill the holes on CNC.
I am waiting for a bigger motor. The board will work with higher currents, it's just a problem of final stage Mosfets.
Here is the latest schematic and firmware also.
Re: DIY AC Servo Drive - ATMega based
Looks pretty good to me. Keep up the good work.
Mike
Re: DIY AC Servo Drive - ATMega based
cd rom motor as bldc ???
Keep up the good work
Re: DIY AC Servo Drive - ATMega based