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 moduleSG-5010 ServoL298 Dual H-Bridge Motor DriverBluetooth Beeaccelerator module and line finder brick are used for functioning.
- 2 Seeeduino V328
- 1 HCR mobile robot kit
- 2 Bluetooth bee
- 1 Ultrasonic range measurement module
- 1 L298 Dual H-Bridge Motor Driver
- 1 SG-5010 Servo
- 2 electronic brick shield V4
- 2 Bees shield
1 three-axis accelerator module
3 Line finder brick
1 rechargeable storage battery.
Now you can Start to make your own electronic pet.
Step 1 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/Counter 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 32 times). As to how to change the frequency you can refer to mega328’s data sheet.
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 Seed 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.
Step 2 Let the Seeed Pet 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, Seed Pet turns left. Any other conditions Seeed Pet will stop.
Step 3 Let the Seeed Pet see
In case that Seeed Pet would run into some fatal obstacles, I need to have the Seeed Pet ‘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.
Step 4 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.