TED

January 2013

TED basically stands for Totally Easy Design and is the same format many four servo bipeds use like the EZBiped series. Having run across a few of the nice four servo builds o nline as Bonnie, Arduped, and µBipedino(TM), I wanted to put something together. I also wanted something I could leave on my desk at work to get a little attention and a wheeled robot usually just runs too fast for my cramped desk. This is NOT the case for TED – he hobbles along quite slowly. Sorry for the long write up, just trying to be descriptive and detailed.

The Beginning…

Using a standard small square circuit board and some standoffs I noticed an HC-SR04 fits the size perfectly across and vertical so “TED’s head” was born. The hip/leg format was pretty much set by the simple design like the others so I stuck the 300mah 9v between his hips and planned on mounting the hip servos on the side. Some four servo bipeds flip the servo so it is part of the leg and the hip hooks to the body but I used the way the bots above are as it just fit better and looks better to me. TED started out with only one leg as I only had two servos that size so I completely built the bot before adding the second leg. Pretty dedicated to making it work at that point. :-/ The servos are some basic 9g units that were $3 a piece, the same used on my White Legged Spider Monkey Hexapod and have seemed to work out ok. They fit nicely from the battery to the edge of the circuit board as well so that was a plus. The “legs” – not sure what else to call them – that connect the hip servo to the ankle servos are some basic sheet aluminum pieces that I had from my car hobbies. I drew out the basic design from the EZ Biped images and hand cut them.

Monkey Brain..

TEDs brain is one of the Pololu Baby Orangutan MCUs that I picked up on sale for $12.95 around Thanksgiving 2012. I kind of hated using one of these as the built in dual H-Bridge is not used on TED but the size and price was right. I like these little controllers as they are cheap ($19.95 normal priced), have a built in dual H-Bridge, 10 digital I/O pins, 7 A/D channels, a built in pot on one A/D and a built in LED. It’s an ATMega328P based board so you get plenty of code storage and performance as well. You do not get ALL the pins/features or a true Arduino or clone but you can do a lot with what you do get. You can also use the Arduino IDE to program it although it does require a basic USB AVR programmer which was $19.95 from Pololu. Using the Arduino IDE was MUCH easier than trying to setup the full AVR Studio for me and keeps me in a common interface. Just my opinion.

Sound off…

I really wanted some sound output for TED so I scavenged a small speaker from a dead Nuvo GPS system (wish I could hack the video/touch screen from it!) and put that up front just below the SR04 which fits nicely and covers up the battery end. For sounds I used some sample code found online to generate some random sounds or play some basic music. Of course TED cannot be doing anything else while the music/sound is playing but that hasn’t been an issue so far. Sound is mainly used for the startup show but I like to use a little “blip” routine when the sonar sees something. I can turn on a flag to even have the sound match the sonar “depth” so it’s lower when things are far away and gets higher and higher the close something gets. Of course that DOES slow the main loop way down so it’s mainly a debugging tool but the bot can flip the flag on itself if I want it to. I’m working on some other sounds and music to add to the code such as making a funny little sound when he sees something or after having been left in “wait mode” for a while or similar. Just fun stuff.

Light Show…

I always like having at least some LED outputs for debugging purposes if nothing else so a couple very old square yellow LEDs I had in the junk box were fitted below the speaker. They provide some feedback in regard to when I can push setup buttons, which direction he has seen something, when he is getting ready to start, etc. Just handy outputs plus always good to have some visuals in my personal opinion. I’d still like to add some more LED outputs but haven’t decided what/where. Was thinking of putting something on his feet but that is another wire to run and make fit in TEDs head where space is limited (see below).

Need Input…

The HC-SR04 is a cheap unit I picked up in bulk and is actually mounted upside down with a four pin connector glued to the top “head board” allowing the sensor to be unplugged as needed. I also wanted some switches to allow some input on the fly for setups, mode changes, etc so a couple micro switches from an old mouse were used. They were placed right above the SR04 “eyes” and kind of look like eyebrows sticking up adding a little more personality. Additionally a switch from an old Palm docking station is used in the back for easier access to the CPU reset button.

There are two LDRs mounted on the sides of the speakers but I’ve found out with the White Legged Spider that following light with a walker is a completely different ball game code wise due to the constant movement and light changes. I am still working through how I will handle reading the light sensors on the Spider and will apply that same logic here but am guessing I need to only read light sensors when the bot is generally facing forward and level. Otherwise it’s easy to get stuck in a go left / go right / wait / WTH situation as the bot moves and the light values change on each sensor. Makes it look like it’s having a seizure or something.

I originally had planned on putting a small PIR sensor on the top of his head but after positioning it over and over it just didn’t look right and I like his “square” head better anyhow. A PIR is useless while the robot is moving anyhow so it’s functionality would have been limited to reading while standing still so I scrapped it.

TEDs Brain…

Putting It Together
Getting all those connections to fit in TEDs head is a bit of a challenge and the more items I added the tighter it has gotten. The distance between the bottom and top head boards is just enough for the connectors to plug in with some room for the wire but it’s very very tight. I’ve shortened the servo wires so there is just enough extra to move the connectors around so I do not have to wrap any extra wire up in the head. I needed a power switch as well and didn’t want a big switch sticking out somewhere so pulled the little slider switch off the dead GPS system and put it on the right side which worked out perfectly.

The assembly is basically all hot glue based except for the top headboard and SR04 sensor. The LEDs also plug in so I can replace them if needed but otherwise it’s a “glue job” so changing very much of the setup is out of the question. Hopefully the battery will last through a lot of recharges as replacing it requires pretty much full “disassembly”.

The Feet…

I was way over optimistic on foot size when I started TED. I cut out some pretty simple square aluminium feet and tacked them on the ankle servos expecting to be able to make them work. Re-using my White Legged Spider walking code routines, I immediately ran into the differences between a stable low tripod platform and a top heavy biped setup. The routine simply moved the servos from frame position to position at full servo speed. Easy to code and what you want or at least can use in a tripod gait. I just slice the walk cycle down to XX frames and have a timer that tracks when to move to each frame using a select statement.. err “switch” statement. I can change the “walktimer” (time between frames) and the sub takes care of tracking what frame to put the walk cycle into. That didn’t work on TED as moving from locations such as LeftHipCenter to LeftHipOut creates a lot of momentum especially when the right leg is off the ground. With little feet he is easily thrown off balance fore and aft.

First I modified the code to have some “substeps”, i.e. for each frame, slice that up even further breaking the movement down into finer steps. This works but there is still something wrong with the code as my goal of dynamically assigning the substep count and time slice based on the main loop delay vs the walk delay doesn’t work. I ended up just setting the sub step variable to three to get at least SOME smoother movement. Even with a slightly longer foot, TED easily fell over frontwards due to momentum so I came up with the triangle / wing foot design. This still allows positions such as an “embarrassed” / “have to pee” position with both hips pointing in to an open legged cowboy position but still provides the needed front / rear stability. Not the best looking feet but they are working. I still have to find a good traction solution however as on slick surfaces TED slides around too much. Thinking of adding a thin layer of the “Plasti-Dip” stuff to the bottom of the feet as a first try. I really do not want to add thick rubber bumper feet as the higher you get the less stable he will be.

The Walk…

The walk routine was pretty straight forward although the turns are not correct yet. They work, but just do not look right. By having the frame based walk subroutine I can have TED simply take one frame at a time. By leaving TED powered down I could manually walk through the steps needed by moving his legs and then sequence the walk pattern. The basic patterns I have are walkstop, walkforward, walkbackwards, walkleft, and walkright. They each use the walktimer that is sliced up into steps by a small function that takes the timer value, the timer time slice and how many steps in the cycle. This allows the walking routines to be called over and over by the main loop without any delay() commands so the sensors can continue to be read and acted on.
I am currently working on a variable that gets set depending on which walk cycle TED is in so I know if his head is facing left, right, or forward. I hope to then use that variable to “walk away” from the object instead of just randomly turning upon detection.

Entertainment Routines…

The walk routine was pretty straight forward although the turns are not correct yet. They work, but just do not look right. By having the frame based walk subroutine I can have TED simply take one frame at a time. By leaving TED powered down I could manually walk through the steps needed by moving his legs and then sequence the walk pattern. The basic patterns I have are walkstop, walkforward, walkbackwards, walkleft, and walkright. They each use the walktimer that is sliced up into steps by a small function that takes the timer value, the timer time slice and how many steps in the cycle. This allows the walking routines to be called over and over by the main loop without any delay() commands so the sensors can continue to be read and acted on.
I am currently working on a variable that gets set depending on which walk cycle TED is in so I know if his head is facing left, right, or forward. I hope to then use that variable to “walk away” from the object instead of just randomly turning upon detection.

Unexplained Results…

Sometimes when you’re coding a bot I’ve found you can get an unexpected unplanned result, usually from a basic bug or error in your code, that creates a desirable output. I had that with the White Legged Spider when the long gait ended up making it rear up on it’s hind legs so I used that in it’s “attack mode” function. On TED, if you’ll notice when TED sees something while looking at the right side he reacts as if he is surprised or something. I’m pretty sure it’s just a code error of how my avoid routine resets the servo positions (unless TED really is coming to life) but I find it kind of cute and would like to implement the same concept when looking left. I’ll likely break the “cute” results code when I try to “make” it happen but we’ll see.

The Future…

I’d still like to add an IR receiver and emitter to allow some type of remote control and “remote controlling”. I could then use an IR remote to change modes, jump to the “entertainment” routines like the Star Wars music / trying to fly, the bounce from foot to foot, a little the Hokie Pokie, etc without having to touch TED. I’d also like him to have IR output so he could turn on/off certain things or control his own little pet robot like the HexaBug walkers I have by learning the codes and playing them back under his own control.

I need to work on the LDR sensor read timing for light seeking but am thinking of having that mode just turn towards or away from the light instead of chasing it. Works better for a desktop robot anyhow and easier to code. Maybe a little sound effect when the light balance changes and a turn towards/away from it. By coordinating sounds such as a short up sound when looking for light or a slower lower sound when trying to hide from it. Silly stuff but fun reactions.

I also have to do something for the bottom of the feet to get better traction as mentioned above but most of the future code for TED will likely be “entertainment” routines just to have fun.

Sprained Ankle and Gotta Go Update 1/12/2013

After running TED for a while his right ankle would work / not work / work / not work, etc and finally he was walking around like he had a bad ankle. Testing the port with another servo revealed the port was fine so I figured one of the cheapo servos had died and started the surgery. I pulled that leg off from the hip servo and pulled the foot off thinking I would just replace the problem joint.

However, after pulling it all apart I spotted the problem – The wire going into the servo was broken loose and depending on how the ankle moved the wire would work/not work. So instead of replacing the servo and have to re-shorten the wire run by putting new ends/hood on it again I pulled it apart and checked it out. Tough solder such a tiny board but the repair was done and worked fine.

Lesson learned is that servo wires are NOT made to move back and forth as they expect the servo to be still so make sure you add a little re-enforcement to the entry point on cheap servos on any legs that move. A little hot glue should resovle the issue I think. TED is back in action and now does his little thing in the new video. Silly but that is what TED is all about.

Website Security Test