Page 1 of 1

Hex bug hack

Posted: Sat Nov 28, 2015 2:28 pm
by craigching
Hi all,

I'm an electronics neophyte looking for an introduction with a fairly simple robotics project for me and my kids. I love the idea of pythonic robotics and I just received my board a few days ago. I thought as an introduction a hex bug spider hack might not be too hard for me and it would really impress my kids as well. After reading the docs, wiki, and forums, I think I can do this, but I would like a little guidance.

I'd like to hack the hex bug into an obstacle avoiding autonomous robot (the light on my kids face when I told them we were going to "free" the robot was priceless!). I've settled on the HC-SR04 sonar sensor as it was recommended in a forum post, so I think I have that well in hand. The part I'm not sure about is the dc motor controller. The hex bug uses an ST1155A dual motor controller on-board. The motors are low voltage (3.5V - 5V) so I'm looking for something that will be good for these motors. Would this be a good choice?

https://www.pololu.com/product/2135

If not, can you recommend something else? I'd also like to get a couple of motors that would work well with whatever motor controller I need for the hex bug to prototype with, so motor suggestions would be helpful as well. Any other suggestions or advice are welcome as well. I plan to do a little fiddling and a lot of reading as well as deep-diving into electronics, so any advice at all is appreciated!

Re: Hex bug hack

Posted: Sat Nov 28, 2015 4:27 pm
by JonHylands
That motor driver board from Pololu will work fine with MicroPython - that is the exact board I use for uCee, one of my MicroPython robots.

Sonar works well, although I tend to use IR range finder sensors. For example, I'm going to changing out the sensors in Roz for these:

https://www.pololu.com/product/136

Or you might like these ones, which work better at closer ranges: https://www.pololu.com/product/2464

Although these are 5 volt sensors, the analog voltage never rises above 3.3 volts, so you can plug them directly into any of the A/D pins on the pyboard.

If you would prefer something smaller and simpler, you can use these: https://www.pololu.com/product/2465

They are digital, and can run off 3.3 volts.

Here's my thread for Roz, in case you're interested: http://forum.micropython.org/viewtopic.php?f=5&t=1189

- Jon

Re: Hex bug hack

Posted: Sat Nov 28, 2015 4:42 pm
by craigching
Great, thanks Jon! I have already read that and other posts of yours, you're doing very cool stuff! :D

IR vs. Sonar, yeah, I was thinking I'd prefer IR to sonar, but there is already a driver for the sonar so I'll work with that first.

Any motors you'd suggest I work with that motor controller? I want to play a bit before I hook things up to the actual hex bug parts. I suppose any low voltage dc motor should give me a good experience that will be similar to the hex bug?

Re: Hex bug hack

Posted: Sat Nov 28, 2015 5:03 pm
by JonHylands
Well, ideally you would just hook it up to the hexbug. I don't know what motors it uses - have you got a decent link to the one you have? There are a lot of different hexbugs in many different sizes and shapes.

Re: Hex bug hack

Posted: Sat Nov 28, 2015 5:06 pm
by JonHylands
And in terms of drivers, this is what I use for the 4-30cm Sharp IR sensor:

Code: Select all

#================================================
#
#       Class RangeFinder - return distance in cm
#

class RangeFinder:

    def __init__(self, pinNumber, rangeMax = 20):
        self.adc = pyb.ADC(pinNumber)
        self.rangeMax = rangeMax

    def getDistance(self):
        value = self.adc.read()
        voltage = value * 0.0032258 # 0-1023 -> 0-3.3 volts
        distance = 100 * ((1.25 / voltage) - 0.15)
        if distance > self.rangeMax:
            return self.rangeMax
        else:
            return distance

Re: Hex bug hack

Posted: Sat Nov 28, 2015 5:24 pm
by craigching
JonHylands wrote:Well, ideally you would just hook it up to the hexbug. I don't know what motors it uses - have you got a decent link to the one you have? There are a lot of different hexbugs in many different sizes and shapes.
Ah, yes, that would be good information ;) This is it:

https://www.hexbug.com/hexbug-spider.html

I have been looking for specs on the different parts, but they don't seem to be well documented. I suppose I could just go for it and hook it up directly to the spider and try it out.

Thanks for the rangefinder code, I'll pick up one of the IR sensors you recommended as well and have a play :D

Re: Hex bug hack

Posted: Wed Jan 06, 2016 11:28 pm
by ymaayan
@craigching
I am very interested in doing exactly what you are talking about here. Have you completed the spider bot? I am a complete noob here, where should I start?

Re: Hex bug hack

Posted: Thu Jan 07, 2016 3:42 pm
by jlawson
Just for interests sake, they also have a VEX version of the same spider design:

https://www.hexbug.com/vex/hexbug-vex-r ... pider.html

which may be more amenable to hacking.
We just finished building one of the VEX structures and it seems quite sturdy yet forgiving (2 and 5 year child old tested....).

Re: Hex bug hack

Posted: Fri Jan 08, 2016 12:36 am
by craigching
ymaayan wrote:@craigching
I am very interested in doing exactly what you are talking about here. Have you completed the spider bot? I am a complete noob here, where should I start?
I haven't finished it yet, I am finishing up a project for work, then I'm back at this :) My kids are wondering the same thing ;)

Right now I'm working on understanding dc motors, I recently made a post about that and got some help. I feel confident that I can complete this soon! When I do finish, I will definitely share what I've done!

Re: Hex bug hack

Posted: Fri Jan 08, 2016 12:40 am
by craigching
jlawson wrote:Just for interests sake, they also have a VEX version of the same spider design:

https://www.hexbug.com/vex/hexbug-vex-r ... pider.html

which may be more amenable to hacking.
We just finished building one of the VEX structures and it seems quite sturdy yet forgiving (2 and 5 year child old tested....).
That's pretty cool, thanks for sharing! I prefer the way I'm doing it though as I'm learning a *ton*. Before this, I'd never soldered, so I bought a Hakko station and haven been doing some soldering. I love diving into the details and making this stuff work! During the day I'm a software engineer, so the programming comes easily, of course, but the electronics is completely new!