SEEED PET is kind of an electronic pet in our studio. It is a platform for the newbie engineers to be familiar with our company’s products and practice. Every newbie engineer will be added some new ideas or elements on the SEEED PET.
The body of the SEEED PET is an HCR (House care robot) mobile robot kit which is a two wheel drive mobile robot platform which has three levels included; Seeeduino V328 is used as the mother board, electronic brick shield V4 and bees shield are used as extension boards. Ultra Sonic range measurement module、SG-5010 Servo、L298 Dual H-Bridge Motor Driver、Bluetooth Bee、accelerator module and line finder brick are used for functioning.
The whole set of SEEED PET
1 x HCR mobile robot kit：
2 x Bluetooth bee：http://www.seeedstudio.com/depot/bluetooth-bee-p-598.html?cPath=2
1 x Ultrasonic range measurement module：
1 x L298 Dual H-Bridge Motor Driver：
2 x electronic brick shield V4：
2 x Bees shield：new product
1 x 3-axis accelerator module：new product
3 x Line finder brick：new product
1 x rechargeable storage battery.
Now you can Start to make your own electronic pet：
Step1 Make the SEEED PET move.
To make the SEEED PET move, I need Seeeduino V328, L298 Dual H-Bridge Motor Driver, HCR and storage battery (12V). The storage battery supplies power for L298 Dual H-Bridge Motor Driver board which can output 5V to Seeeduino V328. EA, EB, I1, I2, I3 and I4 on the L298 Dual H-Bridge Motor Driver are connected to the digital pins of the Seeeduino.(note: EA and EB need to input PWM signal, you can make your own PWM signal using the GPI/O of Seeeduino, but here I use the PWM pins of Seeeduino).
TIPS: The speed of the DC motor is control by the PWM duty cycle input from EA and EB (on the L298 Board), there are three pairs PWM output pins on Seeeduino V328( digital pin（3,11）,（5,6）,(9,10) each parenthesis is a pair of PWM controlled by Tx/Cx), the default frequencies for Seeeduino V328 are: Pins 5 and 6: 1KHz, Pins 9, 10, 11, and 3: 500Hz. When I use the default frequency（here are pins 9 and 10）to drive the DC motors, it is very noisy, and I was told that the frequency should be higher so that the DC motor would be in its better performance and the noise would be reduced, so I change the frequency at 32Khz(it is reference frequency from the motor supplier).
Here is the reasons why I choose PWM pair pins 9 and 10(related to TIMER1): pair 3 and 11(related to TIMER2) are obvious cannot be used, coz pin3 is used for interrupt 1（INT1）input from the DC motor. PWM pair pins 5 and 6 are related to TIMER0, it is a default Timer/Cunter for many arduino libraries, if it is changed the function like delay() will be incorrect（if you change the default frequency 1khz to 32Khz，the function delay() will speed up to 32times）. As to how to change the frequency you can refer to mega328’s datasheet.
You may complain why my pet can walk straight, that is because the different friction and some other factors between the two DC motors are inevitable. The good thing is the two DC motors of SEEED PET have their own encoders based on photoelectric, each one have two channels output A and B, can be used as quadrature encoding. In this project, because Seeeduino V328 only have two external interrupt inputs（digital pins 2 and 3）, so I only use one channel of each DC motor to measure the speed of wheel. In this way speed control can be achieved, walking straight won’t be a problem.
L298 Dual H-Bridge Motor Driver board DC motor with its own encoders
Step2 LET the SEEED PET can find its way.
Now that the SEEED PET can walk, I need it can find its way back home. I use three line finder bricks which has two output modes—digital output and analog output (here I use analog output). The three line finder bricks flag as left, right and middle. While the middle one is detected black line and the other two are not, SEEED PET moves forward. While the left one is detected black line and the other two are not, SEEED PET turns right. While the right one is detected black line and the other two are not, SEEED PET turns left. Any other conditions SEEED PET will stop.
Step3 LET the SEEED PET can see
In case that SEEED PET would run into some fatal obstacles, I need to make the SEEED PET can ‘see’. In this project SG-5010 Servo together with Ultra Sonic range measurement module which only has 3 pins that two are dedicated to power and ground, while the third one is used as both input and output, and also compatible with electronic brick, are used as range measurement. Three zones are divided as SAFEZONE, DETECTZONE and STOPZONE. If the obstacles are in the SAFEZONE, HCR will ignore them; if the obstacles is detect in the DETECTZONE (DETECTZONE is between SAFEZONE and STOPZONE), ultrasonic begin to search from left to right, and if it detects a SAFEZONE, HCR will turn to this direction; if the ultrasonic detects obstacles in the STOPZONE, HCR will stop or move backward. Now the SEEED PET can see the obstacles.
SG-5010 Servo together with Ultra Sonic range measurement module
Step4 Remote control the SEEED PET
In the beginning, one Bluetooth Bee which is compatible with existing Xbee sockets, is used to communicate with the PC through Bluetooth adapter, instructions can be sent from PC to HCR, in this way, HCR can be remote control through PC. And likewise data from HCR can be sent back to PC, so intercommunication between human and HCR can be easy to set up over PC platform. Because I have been working on a new 3-axis accelerator module based on MMA7660 which is Digital Output data via I2C bus, I think why not make a remote control based on this new accelerator module. So I use another Bluetooth bee, Seeeduino and accelerator module as a remote control panel, and the HCR’s movement can be control by my gesture, although the movement is the simple backward, forward, left, right and stop.
Mother board on the SEEED PET
Remote control panel for SEEED PET
Bluetooth Bee Accelerator module
SEEED PET demo codehttp://www.seeedstudio.com/blog/upload/SEEEDPET_arduino_code.rar