25 Command Functions Over 2 Wires

 
#1

There has been some discussion on the forum on I2C port extenders for the EZ-B so I thought it may be relevant to show what we are doing with this on the EZ;1 and EZ:2 robots.



The EZ-B is an I2C master so the external (18 pin) micro must be a slave (although it is possible to have more than one master on an I2C bus), in the video the EZ-B script sending the I2C commands can be seen running in the background.

The EZ:1 currently has 25 head functions, the single head micro does all the work (releasing the EZ-B to do other things) like controlling the eye servos, RGB LED pupils, PWM eye rims, smile LEDs, Frown LEDs, ear LED rims and also sends head sensor data back to the EZ-B. When in debug mode the micro also sends out the last command to an I2C LCD that's connected to the bus as you can see in the video. If the head was directly connected to the EZ-B it would use 12 EZ-B port lines.

User-inserted image

#2

That was great, thanks for the video. Now I know what the l2C port can be used for.

Smile Smile Smile Smile
j

#3

That's awesome @Tony! I2C is the way to go for a multi control hierarchy with EZ-B at the top Smile. Though it does mean a lot more programming then the EZ Control format. I presume the sub controller could be some thing like an arduino loaded with a "stock set" of functions. I would be interested to know if the EZ-B could control the various sub controllers "on the fly" and not grind down the processing time over all ....like the human body which has a lot of autonomous functions but when you need the body to listen to the brain it better be able to run/jump (here comes a lion Smile ) Thanks for sharing Tony

#4

Fantastic work! Thanks for sharing the video.

#5

@irobot58 I have never used an arduino or an AVR in my life, I have been programming PICs for over 20 years and have produced extensive code libraries that does pretty much everything that I need. For the EZ:1 and EZ:2 head micro I use the PIC16F819 which is packed with great features. The 16F819 micro costs around a £1 (in volume), so its not expensive considering how much functionality it adds to the robot.

The EZ-B here just sends the command (just one byte) to the PIC, then the PIC does all the work so I guess you can call it a sub controller.

Tony

#6

That's awesome, it's something I keep meaning to look in to myself but so far haven't gotten around to it. Originally I had planend to use Arduino (for simplicity more than anything) but the £1 16F819 micro sounds much more tempting!

Is the 16F819 difficult to program?

#7

Hi Rich

I built up quite a big code library for PICs over the years, so what you see in the video is about a days work. But starting from scratch it would take you quite a bit of time to do the more complex stuff like I2C. All my boards have in-circuit programming, so I can download new firmware straight into the head itself, the in-circuit programmers are around £30.

If you need something specific (and dont mind waiting until I get some spare time), I could knock one up to your particular specification, then you will just need to add it to a stripboard. If you had an in-circuit programmer, then if you needed any modification, then all I need to send you is the .hex file

Tony

#8

To be honest I'm just looking to add more strings to my bow more than anything else or anything specific.

Melvin's head could have done with it's own PIC for eye movement and LEDs etc. but now I've replaced the LEDs for BlinkMs it's barely worth doing for 2 servos. I will bear that in mind for future project though, I have a few things in mind that will need a lot of ports where I'd like them grouped together but that project is getting further and further away these days.

#9

@Tony , thanks for the update, and someone who has extensive experience with PIC s you would naturally implement them Smile For me and a lot of others on the Forum keeping the programming simple (EZ) is desirable....but....one likes to explore other possibilities and to quote @Rich " To be honest I'm just looking to add more strings to my bow more than anything else or anything specific."
Glen

#10

@Glen You can get ready made I2C I/O expansion ICs like this

www.robot-electronics.co.uk/htm/gpio14tech.htm

My PIC is slightly different as I also build in routines for things like facial expressions like happy/surprise etc and controlling the servos.

Tony