Process Journal 1- Jingpo

In this class we had experimented with the XBee devices and explore the possibility to complement with Arduino boards(micro and feather). Firstly, we set a chat between two computers using the XBee’s without Arduino; secondly, as an extra activity, we decided to establish a chat such as the messages sent from one computer through an XBee, were received by a second XBee connected to the Arduino. Then we tried to set up communication between two Arduino.

XBee Chat Exercise:

We used the following components:
  • 2 Digi XBee.
  • 2 Xbee Explorer.
  • 2 cables.
  • 2 Computers.
  • 2 Arduino micro.
  • 2 Breadboard.
  • Several wires to interconnect the breadboard and Arduino.

Step1: Download software(CoolTerm) and driver(FTDI USB). The first step consists in achieving communication between two machines connected to the following set:

screen-shot-2019-03-01-at-10-59-01-am

 

Step2: Change the configurations of the radio in command mode. In this second part we are going to show how we can display the information transmitted between two XBee in a screen connected to Arduino. To do that, we need to understand how the XBee Explorer works:

The pins we must connect to the Arduino in order to be able to display the information sent by the other XBee module. The input voltage must be 3V instead of 5V to avoid potential problems. The XBee Explorer is not only important to connect the XBee to the computer, but also to put it in the breadboard so as connections can be set. screen-shot-2019-03-01-at-10-59-10-am

1) Attach Xbees to SainSmart boards and plug into computer

2) Open two CoolTerm Sessions and click on one of the Options buttons.

3) In the Options pop-up select the COM Port of either Xbee and then go into the Terminal Tab and select Local Echo (in order to see what is being transmitted). Then press OK. No additional changes are necessary for standard comms.

4) Repeat the above step for the other Xbee in the other port. If either time you do not see the Xbee’s port as an option, or if you plug it in with the options box open, press the Re-Scan Serial Ports button show in the red box from the above image.

5) Now press Connect for each terminal and you can now type in either and it will transmit to the other. Press Disconnect when finished with the session to ensure it is available for other programs to use.

6) We need to configure XBees to enable the communication. These radios are configured with AT commands, so we learnt some basic AT commands from AT command set:

ATRE = factory reset – this will wipe any previous settings
ATMY = my address – the label on your radio
ATDL = destination low – the label on your partners radio
ATID = pan ID – the agreed upon “channel” both radios are using to communicate
ATWR = write to firmware – this will make sure the configurations are saved even when the radio loses power
ATCN = end command mode

Open CoolTerm:

Go to Options → Serial Port

Go to Terminal → Select Local Echo

Step 3: Let’s chat!

screen-shot-2019-01-14-at-3-50-36-pm

img_0164

 

Once connectivity between the two XBee modules has been established, we can implement the part where we display the information on computer screen.

 

Metronome Receiver Device:

Arduino Code:

Use “Serial” to test the code. Change “Serial” to “Serial1” when arduino is connected to xBee and send the “H” and “L” commands via the serial monitor.

Sample Code is from Arduino example, Physical Pixel. It is an example of using the Arduino board to receive data from the computer.

screen-shot-2019-01-14-at-3-57-39-pm

Add a servo and change the Arduino code:

 

screen-shot-2019-01-14-at-4-00-09-pm

screen-shot-2019-03-01-at-11-18-38-am

img_2832-2

Circuit:

Connect the circuit as show in the figure below:

  1. The servo motor has a female connector with three pins. The darkest or even black one is usually the ground. Connect this to the Arduino GND.
  2. Connect the power cable that in all standards should be red to 5V on the Arduino.
  3. Connect the remaining line on the servo connector to a digital pin on the Arduino.

Notes:

  • Servo red wire – 5V pin Arduino
  • Servo brown wire – Ground pin Arduino
  • Servo yellow wire – PWM pin Arduino

img_3528

I want to have a fan connected to the servo, so I went to dollar store and got this candy toy for 2 dollars, along with an unexpected free motor, a button and a battery.

img_3289img_2411

img_2597

It was my first time to use servo though we had c&c last semester. Usually, they have a servo arm that can turn 180 degrees. Using the Arduino, we can tell a servo to go to a specified position and it will go there. I don’t know how to make it work like a fan. I think I need to choose another type of servo. The code I had will turn a servo motor to 0 degrees, wait 1 second, then turn it to 90, wait one more second, turn it to 180, and then go back. I need to check if I can make it rotate in one direction(not back and forth).

 

 

 

 

Leave a Reply