Motor Movement!

Well, the connectors didn’t turn up on Saturday, but they did turn up today! So after a bit of crimping, and a bit of soldering (and a few mistakes, but we won’t go into that) I had a couple of cables made up to allow me to connect the Q85 motors to the ODrive.

Here is one of the sets of cables. They consist of the red wires in the back that go to an MT60 connector that carries the main signal to the motors, and then another bunch of wires that come from the hall effect sensor that is embedded in the motor. This tells the controller where the motor is in its cycle, so that it knows which coils to energise.

Also needed were some capacitors across the sensor terminals to cut down on some noise. Instructions for doing this are here: https://discourse.odriverobotics.com/t/encoder-error-error-illegal-hall-state/1047/7

With all that in place, I gingerly powered it all up and set about calibrating everything. I followed a guide on the main astromech forum, along with the odrive guide for hoverboards (same principal as driving an astromech it seems). It took a bit of trial and error, that I’m hoping to iron out into a proper tutorial at some point, but the motors were eventually running!

The mixing that I’d done in software all looks like its working as intended. I can also bump the speed up incrementally, as I can with R2, but with a lot more control and accuracy.

I do need to change the ramping settings on this, which I may even make changeable on the fly from the controller. Also the multiplier may need some tuning to set top speed, but that will require some testing in situ. I need to push my changes back into github, and make sure that R2 still works with the new code.

I think this brings the electronics to a good resting place for now. Just going to tidy up some of the cabling and add a volt/current meter. Its time to concentrate on making the actual droid. So this weekend it will be time to don the breathing mask and start glueing everything together.

Software mixing

Currently, my PS3 controller code uses the channel mixing built into the Sabertooth speed controller. This means that I send it speed and turn commands, and the speed controller mixes these to drive R2 in a tank style, where you vary the speed in the feet to go forward/back or turn.

The problem with this is that not many speed controllers do this, so I am very much tied into using the Sabertooth with my code and the Sabertooth doesn’t support brushless motors. Droid 2 is going to use an ODrive, which has no mixing built in.

Well, until now!

I’ve abstracted out the speed controller portion of the code and added a function that takes the two axis from the drive stick and then outputs the required motor speeds. In this video you can see when I push the stick forward, the top number changes to show the position of the axis, and motor 1 is set a signal of 1, or full speed forward and motor 2 gets -1, or full reverse. (Remember, the motors are flipped)

I got the bulk of the code from here:

https://electronics.stackexchange.com/questions/19669/algorithm-for-mixing-2-axis-analog-input-to-control-a-differential-motor-drive

which uses cartesian to polar (and back) transformations.

I still need to hook up the motors, I’m waiting for some connectors to turn up, to check that it actually works and to do the code changes to send the correct signals, but this is a good step forward.

The other benefit to this change is that now I’m not limited to dual motor controllers, and can look at buying cheaper single controllers with a lot less smart technology built in.

Preston Comic Con tomorrow, so R2 and I are out all day, but if the connectors turn up that I’ve ordered, sunday will be a day of connecting and testing the motors.

She Speaks!

Minimal wiring is done now, enough to get everything powered up and r2_control installed.

A quick flash of an SD card, some tweaks to the install instructions, a few small tweaks to the code to make first boot a little smoother, and shes alive!

Only got audio working for now, but it meant I could test the base code and web interface. I need to get a remote working next I think, and then I can start working on interfacing with the Odrive and Q85 motors. Theres already a python module for that, so that saves a lot of work. Unlike the Sabertooth, which required me to write a python module to interface using serial.

Also, the documentation is now up to date for the latest version of Raspbian, and the code now auto creates basic configs correctly so it will work on first start without having to pre write any configuration files. It should also be easy enough to write a setup script to install required packages and python modules.

And of course, seeing as the Pi is powered up I can now remotely access it to do coding from the comfort of my office.

Inside Out

Most people start by building their droid, then doing the electronics. I’m pretty much doing it all in reverse.

Here you can see all the electronics for R2. The left hand board has all the main power, and the right hand board is the actual electronics. Both boards have edging around them, and will happily sit back to back, making the whole system easily removable. It also means that once removed, it can be opened up as shown to be worked on.

Wiring is nearly complete for the core parts (Pi, Odrive, and Amp), I just need to get an XT60 soldered on to accept a battery. Now, I know I’ve a load of XT60 connectors somewhere in my office, but so far they have eluded me. They must be somewhere *really* safe!

Also, at the top of the pictures you can see the stripped down Q85 motors, getting modified to freeze the clutch system.

Next step it to get power to the Pi at least so that I can start installing the brain. It will also be an opportunity to get the documentation improved, and initial config sorted, incase anyone else wants to use my code.

Oh, and I think I’ve decided on a name for my droid.

R0-S3, or Rose to her friends!

Droid number 2 on its way

I’m going to have to give it a work in progress name, but its a bit difficult without even knowing what dome I’m doing!

But anyway, I picked up the CNC’d styrene kit at R2UK this weekend, and decided to get a picture of everything I’ve gathered so far:

So here you can see:

  • Styrene kit, which includes:
    • Frame
    • Skins
    • Shoulders
    • Legs
    • Ankles
    • Skirt
  • Motors (Q85), tyres, and Speed Controller (ODrive)
  • Power distribution (fuses, wires, switches, relays)
  • Amp and speakers
  • Raspberry Pi
  • DC-DC power convertors.

I’ve also bought cells for another battery, which will be identical (a little more capacity) to R2’s current one. That way they can be switched.

Hopefully I’ll be able to make a start on something this weekend. My first main jobs will be:

  • Motor conversion – The Q85s have to have their clutch frozen and rims turned down
  • Electronics mount – I want all the electronics to be removable for ease of maintenance
  • Frame – Actually put the frame together

So, watch this space for which I decide to do.

One droid is never enough

The time has come….

R2 needs a friend.

I’ve actually started collecting bits to make my next droid. I’ll be picking up the bulk of the droid in a couple of weeks at R2UK. I’ve already got the motors, speed controller, Pi, and a few other little bits. Most of the other electronics are on order too.

Not 100% certain on what type of dome the droid will have, nor the colour scheme that I’ll use. That can all come later.

What I do know:

  • Brushless Q85 motors (e-bike hub motors).
  • ODrive controller for the motors (a lot cheaper than the Roboteq most people use).
  • Will use r2_control (of course), but be able to swap out to standard RC quickly.
  • Same battery as R2, so I’ll have two identical ones.
  • All electronics will be on a removable board so that I can pull them out to work on outside of the droid.
  • Dome will be wireless with its own (small) battery.
  • Cheaper than R2 (much cheaper!)

I’ll probably also use steel feet to keep the center of gravity nice and low for stability.

So, it will mean a fair bit to do. I’ve never really worked with styrene before and with using both wireless comms for the dome and an ODrive there will be a fair amount of coding work to do on r2_control.

I’m going to try and keep a better build log for this one, with more work in progress pictures.