# ElectricPolo Segway Clone Build



## electricpolo (Mar 15, 2011)

*Re: Dayton Motor Encoders*

Attached are some pics of my modified 500 watt planetary gearbox motors. These pics show how I fitted a rotary encoder to the rear of the motor. These encoders will be used together with a 2x60A RoboClaw controller. These have 120A max per channel & has inbuilt encoder support. 

I got mine from http://www.robotshop.com/en/usb-robo...ontroller.html. The postage was very reasonable from them..

The motors come from Shane at Motion Dynamics. He is a pretty helpful guy. Here is the link to the motors.
http://www.motiondynamics.com.au/day...ry-500rpm.html
These motors need a fairly serious controller as they can pull 100A easily when close to stall.

I got the encoders from here http://www.surplusgizmos.com/CUI-Inc...-V_p_2463.html. They were about $79 for the 2 encoders delivered to AU. Best price I could find.

How to mount these encoders to pretty much any motor.
You will need a drill press, a lathe, some Chemtools 8680, a couple of 20mm pieces of 3/16" or 5mm steel rod, 4 x 3mm SS screws & 2 AMT102V encoders.

Match mark the 3 motor sections before you dismantle them. Will make it easier to retime the motors on reassembly. 
Disassemble the motor & mount the armature in a lathe. Make sure it is running true. 
Drill a neat size hole to match the size of the rod you are using about 6mm deep in the brush end.
Hold the 20mm piece of rod in the tailstock, put on a drop or two of the 8680 & slide it into the hole in the armature. Leave it until the 8680 cures.
Using the tailstock ensures the new piece of rod runs true with the armature shaft.
Next, fit the brush housing into the lathe & drill a hole about 1mm bigger than the rod right in the centre of the housing.
Rough reassemble the motor and fit the AMT102 housing according to their instructions using M3 screws or some small self tappers.
Disassemble the motor, blow out any rubbish & finally reassemble.
Align your match marks as a starting point for retiming the motors.
Retiming is important so the motor goes the same speed forward & backward & draws the same current in either direction for a given voltage. 
Easy to change timing by simply rotating the brush end slightly.


----------



## electricpolo (Mar 15, 2011)

*Re: Dayton Motor Backlash*

The main problem with the backlash in these motors is due to the sun gear being a loose fit on the motor shaft. See what I mean here. http://youtu.be/HZhlxK4zPqc

Solution is pretty straight forward though. 
Remove the 4 x 10mm bolts holding the gearbox to the motor. Remove the planetary gear housing & the ring gear. Remove the circlip holding the sun gear onto the output shaft. Remove the sun gear & the small key.
Wipe all the grease away and thoroughly clean the shaft, the sun gear & the key with thinners. 
Get a small bottle of Chemtools 8680 (must be this one) from your local friendly engineering supply store. Put a drop on the key, a couple of drops on the shaft & a couple of drops inside the sun gear. 
Reassemble the whole lot & put back the circlip.
Come back tomorrow, stick in some more grease, refit the gear housing & ring gear & tighten the bolts.
The backlash on the output shaft will now be almost nothing.
You can also use the 8680 on the sprocket to bond it to the shaft but make sure it is running true first.
Chains are always a bit of a problem with backlash as they never fit 100% on the sprockets. 
This is why I used the HTD pulleys & belts but I had to specially mill the inside of the small pulleys to match the output shaft shape.
The best you can do with chains is have them just a little bit on the tight side.


----------



## electricpolo (Mar 15, 2011)

*Re: ElectricPolo Segway Clone Progress*

Here are some pics of the progress of my clone. Base frame underside is about 90% done. 
First & second pics show the steel base frame, axles, hubs & wheels.
Third pic shows the motor & drive arrangement. With the toothed belts and after the gearbox mods, the backlash is almost zero. Very good result.
Fourth pic shows upside down view of motors and the battery layout. Ground clearance is about 110mm at the main part of the motor & about 100mm at the gearbox close to the tyre.
Still to do the steering & tiller setup.


----------



## QuietCar (Jan 3, 2013)

Looks nice so far. Can't wait for more pics!
QC


----------



## electricpolo (Mar 15, 2011)

*Re: Tiller Pivot & Centre Springs*

These pics show the tiller pivot shaft. The shaft runs in acetal (Delrin) bearings that are a light press fit into the steel brackets welded to the base frame.
The small tag on the end of the shaft is the mount for the steering MPU.
I tried 2 opposing gas springs for the centreing mechanism but it didn't work. I reverted back to my original plan using 2 strong extension springs. These came out of a washing machine & originally supported the bowl assembly.
This approach seems to work pretty well.
Trampoline springs or the springs of an older car bonnet hinge would probably work just as well.
Tiller arm & handlebars are next.


----------



## electricpolo (Mar 15, 2011)

The first pic show the location of the steering MPU. It mounts on a tag on the end of the tiller shaft. The tag is offset slightly so the pcb is on the centre line of the shaft.
The second & third pics show the underside with the batteries mounted, the relay & fuse block fitted & the RoboClaw controller fitted. 
The motor controller fits neatly between the two motors & keeps the motor leads really short. Also keeps it away from the Arduino which is mounted on the topside.
The power cabling is now done. I used 4 gauge cable for this as this feeds the controller which supplies the two motors. The 2x60 RoboClaw can deliver 60A continuous per channel which means it needs to have 120A continuous fed to it.
It can also peak at 120A per channel which means *up to 240A* into the controller. Having built an electric car, I know the importance of the right size power cable.
You can also see the 24V main relay & the 80A fuse block. The 24V relay will be turned on by a switch on the handlebar somewhere.


----------



## mariocaptain (Apr 8, 2014)

Electricpolo, congrats on the progress so far! quite inspiring as I am building on a set up pretty much like what you have there (yes I also have the idea to use IR sensor to detect rider on board too ). Only that I am still awaiting the parts to arrive.

I am very keen to see your test drive and fine tuning, and see how Ovaltineo's code perform.

Keep us updated.

Dave


----------



## Ovaltineo (Jul 18, 2013)

Very nice build! You obviously either have access to a workshop, or your garage/shed is the best in the suburb .

I would have put the steering sensor mounting tab where the steering shaft intersects the wheel drive line. This way, you probably won't need the board tilt sensor.

I will add provision in the code for a rider sensor. There will be different settings for P, D, and MOTOR_MAX when there is no rider detected.


----------



## Ovaltineo (Jul 18, 2013)

8 X 40Ah LiFePo batteries!! I can doodle around for 30 minutes on 2 X 7Ah batteries. This should be enough to get you across Australia on a single charge !

BTW, what ratio did you use for the pulleys? The built-in gearbox is only 6:1. Will you get enough torque to drive those big wheels off-road?


----------



## electricpolo (Mar 15, 2011)

I have a metal fabrication, engineering & computer background and am very fortunate in having a lathe, milling machine, MIG welder & heap of other toys in my shed.

I did think about using just one MPU but the location of the centreing springs made it very difficult. The board tilt MPU fits underneath the tiller shaft right on the axle centreline (pic soon).

Having provision in the code for a rider sensor would be great. I had been playing with something along the lines of this:

Both sensors off (Clone on but no rider yet) - MOTOR = MIN & PID suitable for machine balance only
One sensor on & one sensor off (Rider has one foot on platform) - MOTOR = MIN or slightly higher & PID suitable for machine balance & rider mounting 
Both sensors on (Rider has both feet on platform) - MOTOR = MAX & normal PID

Gear ratios. As you know, these motors have a 6:1 reduction. I used a further 1.82:1 reduction (22 tooth & 40 tooth) fro0m the motor to the wheel hub. I did work it out so that at a top speed of 16-17km/hr, the motor would still have about 25% speed capacity left for the pushback.
I also based my calcs on the approx working voltage (allowing for sag) of the LiFePo batteries.

I built an electric car that uses LiFePo batteries & I have reasonable idea of the voltage drop due to sag. These batteries tend to sag around 10% under lightish loads & can easily sag 20% under heavy loads. They bounce back very fast though & can keep delivering plenty of current until they get to their discharge cliff.

The big motors can draw a lot of power at times. The motor in my car cruising at around 70-80km/hr will draw about 75A but accelerating hard can draw 320A which is what I have limited the controller to. I could let the motor draw 500A if I increased the controller limit to it's max.

If you are going to use the Dayton motors, you are going to need a beefy motor controller & a couple of 18Ah batteries.


----------



## Ovaltineo (Jul 18, 2013)

Did you get it working over the long weekend?


----------



## electricpolo (Mar 15, 2011)

Not yet. Had a pile of BAS stuff to do. 
Doing the wiring with shielded cable right now.
Hopefully, by the end of the week I will have given it a go.


----------



## electricpolo (Mar 15, 2011)

Managed to do some testing yesterday & today. Have been using RoboClaw Controller for initial testing then I will switch to RoboClaw Encoder.
Have limited the output to 500 (did start at 150 & worked up to 500).
Although I don't have the actual steering tiller setup yet, I do have a temporary fixed vertical pole. 
I have tested the steering by using a spanner on the steering shaft. Works very well but I had to reduce the numbers because it was too fast turning.
Have been able to actually ride the machine forwards & backwards a bit. At first, it felt very strange but after a few minutes it became much easier & more balanced.
Been playing with calibration settings & PID settings this afternoon when the controller suddenly developed a fault & now goes into an error condition as soon as it gets any sort of motor movement command of any sort.
Emailed RoboClaw manufacturers & waiting for reply. Ah well!
I still think it's a good featured controller. I just hope that this is a one off as this controller cost AU$240.


----------



## mariocaptain (Apr 8, 2014)

electricpolo said:


> Been playing with calibration settings & PID settings this afternoon


Glad that it works for you first time. Please keep us updated with your PID setting experiences, and maybe even working values . I will be using the Roboclaw and AMT102V (the latter thanks to you) so your values as initial values would be much appreciated

Do you have to fine tune the PID inside the Roboclaw? I guess the factory set default values should work ok...

Dave


----------



## electricpolo (Mar 15, 2011)

I am using the #define RoboClaw Controller PWM control initially just to get it working. 
Once I have done that I will switch to the #define RoboClaw Encoder.
I have the encoders all fitted & connected up so it is easy to switch by changing the software.
I'll be posting my PID values when I get a bit further down the track.
Need to get the RoboClaw fixed first.


----------



## Ovaltineo (Jul 18, 2013)

electricpolo said:


> Managed to do some testing yesterday & today. Have been using RoboClaw Controller for initial testing then I will switch to RoboClaw Encoder.
> Have limited the output to 500 (did start at 150 & worked up to 500).
> Although I don't have the actual steering tiller setup yet, I do have a temporary fixed vertical pole.
> I have tested the steering by using a spanner on the steering shaft. Works very well but I had to reduce the numbers because it was too fast turning.
> ...


I'm guessing it could be the software serial not being reliable at 38400. Try changing it to 9600 and see it goes.


----------



## electricpolo (Mar 15, 2011)

I don't think its the Arduino software or the baud rate causing this problem. 
I connected the RoboClaw direct to my notebook via USB & tested the controller using the RoboClaw IonMotion software. 
This software talks directly to the controller and the error returns as soon as I send any sort of movement command from this software too.


----------



## electricpolo (Mar 15, 2011)

While I am getting the controller problem sorted with Nathan at Orion, I started doing a bit on the guards. 
Just have to weld some 12 x 3 flat around the edges to stiffen it up and eliminate the sharp edges then I'll weld them both in place.
Got some ERW tube for the tiller assembly today so that will be next.


----------



## Ovaltineo (Jul 18, 2013)

Wow! It's beginning to look like a real "clone".


----------



## adamson (Mar 2, 2014)

Great job!
I'm thinking about encoders too, but it isn't priority.
I will need other motor driver to add encoders, and my motors are to week now.


----------



## electricpolo (Mar 15, 2011)

While I am waiting for the motor controller to get fixed, I welded the guards on and have almost finished the steering.


----------



## electricpolo (Mar 15, 2011)

I have pretty much finished the steering assembly for the clone. I am going to make some sort of switch panel on the handlebars for the On/Off switch, the emergency switch & the LCD display.
I have posted pics of the steering shaft & the MPU mount before so this will be just about the tiller arm.
The first pic shows the more or less completed arm (no switch panel yet).
Second, third & fourth pics show the base of the arm & taperlock hub. This is how it clamps to the steering shaft yet is adjustable & removable. 
Fifth pic shows a closeup of the arm assembled onto the steering shaft.
Sixth pic is an overall view of the arm assembled onto the base.
Here is a short video of how the self centreing steering works http://youtu.be/NuLTbgnkE20


----------



## electricpolo (Mar 15, 2011)

I am doing final reassembly now. The motor controller will be back any day now.
The first pic shows the batteries, the 24V contactor & the main fuse fitted in.
The other pics show the steering assembly and tiller arm all fitted back in place.
You can see the cable that runs up inside the tiller handle. This will be for the LCD display, the On/Off switch & the kill switch.
The last pic shows the cover that goes over the Arduino. The battery charger port is on the back of this.


----------



## QuietCar (Jan 3, 2013)

A beautiful job!

Can't wait to see a video of operation.

QC


----------



## electricpolo (Mar 15, 2011)

I have just bought a genuine Arduino Mega, a couple of Flyduino IMU's, a level converter & a new bluetooth module.
While the Nano worked in basic mode, it became evident that there were software serial issues trying to use the RoboClaw, a bluetooth module & an LCD display all at once as the Nano only has the one hardware port & a Mega is the ideal board with 4 serial ports.
I also got a couple of Flyduino IMU's that are used in RC helicopters to replace the cheap chinese one I got from eBay. The cheapies may work OK but I decided to go 'the whole hog' & get some better quality ones.
I bought a new bluetooth module as I did have the original one connected to 5V for a while. I was having sporadic problems with the original bluetooth module but I don't know if it was the software serial issue or I fritzed something on the module. 
Simple fix by getting a new one & I got a level converter to go with it to properly convert the 3.3V to 5V signals & vice versa.
The motor controller protection has been beefed up a bit with zener diodes on the gate driver outputs & fast recover diodes on the motor outputs.
Snubber caps are now across both motor terminals & 2 very high ripple capacitors have been put across the battery terminals to deal with the high ripple current.
I'll see how it all goes over the next week or so.

Update. The Flyduino IMU's have been scrapped. They wouldn't work & their technical support is very slow & not very helpful. Total waste of money!
I've got a couple of Open Jumper MPU6050 IMUs coming.


----------



## electricpolo (Mar 15, 2011)

Getting close now. I am still waiting for the new IMUs to arrive. Should be any day now.
Am doing all the final wiring and connections. Pretty satisfied the way it's all coming together.
Looking forward to giving another test run once the IMUs are in place & now the bluetooth works.
I've posted some pics of the underside showing how everything fits. There isn't much room left.
I have used a DC to DC converter from eBay to power the Arduino & the sensors and you can also see the extra high ripple capacitors attached to the battery input of the controller.


----------



## Ovaltineo (Jul 18, 2013)

Nice! This is definitely the Mercedes of Segway clones!


----------



## electricpolo (Mar 15, 2011)

I have fitted the new OpenJumper IMU's and wired in the dual IR sensors too.
I have made some small alterations to the code to use the dual sensors on separate input pins. The clone needs both feet on the platform before it will go to full power.
The bluetooth module connects up fine, it goes into remote mode as expected and the rider sensor on/off mode works too.
My replacement RoboClaw controller will be back on it's way to me tomorrow.


----------



## QuietCar (Jan 3, 2013)

What probs did you have with the RoboClaw controller that required sending it back?

Were the extra ripple caps connected across the pos/neg posts?

Thanks, QC


----------



## electricpolo (Mar 15, 2011)

The first time according to Orion, the mosfet drivers blew within 10 minutes & the leads to the caps were melted. Was only going backwards & forwards about 1 metre in the shed when this happened.
They repaired it & also suggested the extra caps across the battery inputs. The caps I used are very high ripple capacity Panasonic caps left over from my electric car controller.
Second time it blew was within minutes of running the motors with no load. First it was a single mosfet driver, then the other mosfet driver & a mosfet too. Maybe the repair wasn't quite right.
They are sending me a new HV 2x60 RoboClaw & I hope this is the end of it. Although I have had issues with the RoboClaw, their technical support has been first class.


----------



## Ovaltineo (Jul 18, 2013)

How did you go with the HV Roboclaw?


----------



## electricpolo (Mar 15, 2011)

I am expecting it to arrive here any day now.
Will post results as soon as the controller is back in.

According to the serial monitor, everything is working as expected.
Either RoboClaw pwm or encoders work fine, steering is OK, dual rider sensors are working OK (motor max, kp & kd all change) & console connects OK & works OK too.
Haven't setup or tried pushback yet. That's next.

In the meantime, I've put power diodes across the contactor & across the main fuse so there is always a path for any regen current even if the fuse blows or the contactor opens & stops power to the controller.
Came across this recommendation from a Roboteq wiring diagram for their controllers.


----------



## revwarguy (Oct 7, 2014)

Very nice work, ElectricPolo! your frame looks very robust!

Was wondering if you have a schematic, or perhaps can point to one you followed with a list of your additions/exceptions? Curious about the foot sensors, solenoid, diodes, isolation, etc.

Very nice looking work. Hope you have a great ride there!

TIA,


----------



## electricpolo (Mar 15, 2011)

It is all my own design adapted from many other's ideas. I will put a schematic together & post it up.
I am still having some issues with the opto isolation that I'm in the process of tracking down.
Apart from that, I'm pretty happy with the way the rest of it has shaped up.
The mechanical side of it works very well.
Main points to pay attention to.
Make the tiller to frame attachment very sturdy. It will get a workout.
Make sure you have absolutely minimal backlash between the motors & the wheels.
Have a contactor/solenoid in the battery cable.
Always have a kill switch that stops the motor controller mounted up on the handlebar.


----------



## electricpolo (Mar 15, 2011)

Been doing a lot of work tracking down I2C interference from the RoboClaw HV. It is very noisy electrically and was causing multiple I2C errors that made the clone jerk badly. 
I started by using 6N137 optocouplers between the Arduino & the RoboClaw HV. It helped a bit but the errors still occurred at higher currents.
I then used a Traco fully isolated DC DC converter to power the Arduino & the sensors. It helped even more with the errors becoming smaller & more intermittent.
The RoboClaw technical people felt that is was a grounding issue so we concentrated on this & did a whole series of tests using different grounding points & ferrites.

This is what eventually worked and stopped all the I2C errors.
100uF electrolytic caps were put across the DC DC converter input & output.
All sensor cable shields & the RoboClaw comms cable shield routed through a small ferrite & terminated at the DC DC converter input.
The metal chassis was grounded to the RoboClaw battery negative.
A ferrite was put over the RoboClaw comms cable as close as possible to the S1 & S2 pins on the RoboClaw.
Another ferrite was put on the power cable to the DC DC converter as far away from the converter as possible.
Ferrites were put on both motor cables.
Any DC cables were twisted together & routed away from sensor & comms cables.


----------



## roscoopc (Oct 14, 2014)

Only roboclaw and sabertooth have this problems? 
I am building my clone but at this moment I am working on frame and belt pulley... Electronic will be the next step


----------



## electricpolo (Mar 15, 2011)

Only the brand new RoboClaw HV (the high voltage one) has these noise issues. It is a new design & switches at a much higher frequency than the regular RoboClaw controller.
The HV is still probably the best controller to use. Has higher resolution than the Sabretooth, handles higher voltages & back EMF better & has encoder support built in.


----------



## Ovaltineo (Jul 18, 2013)

Did you work out what was causing the stepper motor like mis-steps on one of the motors?


----------



## electricpolo (Mar 15, 2011)

Nathan reckons it was the over-current kicking in. The motor didn't actually stop or lose power. He also said that the controller temperature has a lot to do with the cut-in level.
It was a pretty hot day and I had been trial riding the clone across the front paddock & the heatsink was fairly warm. Have mounted a couple of fans on the heatsink now. Will post some pics later.
Have started fiddling with the encoders in IonMotion with lots of success. Next, I'll try using the clone software.
All looking very positive now.


----------



## Ovaltineo (Jul 18, 2013)

I'm looking forward to the videos...


----------



## electricpolo (Mar 15, 2011)

Here are some pics of the fan assembly I made. It screws onto the sides of the heat sink. The sides of the mounting bracket have been cut away to allow for unobstructed air flow from the fans.
The fans are 2 x 40mm 12V 7.2cfm in parallel and I used the original ebay DC DC converter to give me a stable 12V from the battery pack.
The fans run all the time the clone is turned on although they could be switched on by the Arduino if you wanted to.

The other thing I did to the controller was to put a 4K7 pullup resistor on S3 as I was getting erroneous e-stops from time to time. The pullup resistor fixed that problem.


----------



## SailorKane (Jan 26, 2015)

Beautiful build!!!! I'm building one too and ha e a nitty question. The springs you used for the control column are nIce. Do you have any idea of the specs on them? Particularly pounds per inch of stretch? I was thinking it has to be strong, considering the short stub compared to long column. Perhaps 20#/inch? More?


----------



## Harry10 (Jul 13, 2016)

Hello electricpolo,

Super Clone, great implemented.

you have your Segway Clone built ready?
Which PID values you have used.
Iam RoboClaw 60A and the same type of motor you also.​


----------

