Note: I used the xbee I linked to, but for a one to one communication, rather than a network of wireless devices, xbee series 1 would do fine, but the AT commands are slightly different.
Step 1: Materials
Any DC motor
power supply or battery
usb mini cable
Step 2: Set the firmware on the xbees
2.With the first Xbee plugged into the Xbee Explorer, and the usb cable connecting it to the computer’s USB port, Open up X-CTU.
Click “Modem Configuration”
Click “READ” in the top left.
3.Set the first Xbee (the one currently plugged in) as ZIGBEE COORDINATOR AT (see the top)
5.Then, make note of the SH and SL
The SL is unique for each xbee. A great practice is to LABEL on that xbee the SL so you always know its address.
6.Then, set the DH and DL of that xbee to the SH and SL, respectively, to the xbee it is going to be talking to and listening to.
(the SH and SL can be found on the BACK of the XBEE on the white label)
7. Click WRITE.
8. Once it is finished, (see the bottom of the monitor), remove it and place the other xbee in the xbee explorer. You can unplug and replug the USB but you don’t have to.
9. Click READ again in the top left of the X CTU window.
10. Set this Xbee to be ZIGBEE END DEVICE AT.
11. Set it’s PAN ID to be the same UNIQUE PAN ID of the other xbee (1234 in my case)
12.Set the DH and DL to be the SH and SL of the OTHER Xbee that you previously updated.
13. Press WRITE and wait for the firmware to be updated.
You’re xbees should talk now!
If you had a second xbee explorer and another computer, you can hook both xbees up, and in X CTU go to “TERMINAL”.
Whatever you type in one terminal window should show up in the other computer’s XCTU terminal window.
Step 3: Wire the motor
The H bridge has the following pins and functions: The H-bridge has the following pins and features:
Pin 1 (1,2EN) enables and disables our motor whether it is give HIGH or LOW
Pin 2 (1A) is a logic pin for our motor (input is either HIGH or LOW)
Pin 3 (1Y) is for one of the motor terminals
Pin 4-5 are for ground
Pin 6 (2Y) is for the other motor terminal
Pin 7 (2A) is a logic pin for our motor (input is either HIGH or LOW)
Pin 8 (VCC2) is the power supply for our motor, this should be given the rated voltage of your motor
Pin 9-11 are unconnected as you are only using one motor in this lab
Pin 12-13 are for ground
Pin 14-15 are unconnected
Pin 16 (VCC1) is connected to 5V
See here for more info.
(Also, before wiring the motor, I took off the top so i could look at the gear box – the gears look super cool…see the images)
Step 4: Upload the Code
Now, you can adjust the direction of the DC motor by pressing ‘a’ and ‘s’ in the serial monitor of Arduino.
If you are using servos like I was in the video with three servos mounted to a wireless webcam, you can use this code instead:
Read more: Use xbees (series 2) to control a motor