With a program that talks to Serial from the seeduino film with baud rate 19200, and two xbees on explorer boards set to baud rate 9600 and two terminal emulators set to baud rate 9600, we can establish a serial connection from the seeduino film to the computer via the xbees.
One xbee is just on the explorer shield and connected to the computer via USB, a terminal emulator attached to it (powered via USB from the explorer).
The second xbee is wired to the seeduino film's breakout board (powered via USB) like this: 5v and ground are connected, and RXD on the seeduino breakout board is connected to DOUT on the xbee explorer, and TXD on the seeduino breakout board is connected to DIN on the XBee explorer shield.
Tuesday, September 27, 2011
Arduino Nano vs Seeduino Film
When compiling code for Arduino Nano, choose Arduino Duemilanove, when compiling for the Seeduino Film, choose Arduino Diecimila. So far, so good.
Uploading Arduino code that establishes a serial connection like this
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print("arduino greets");
delay(2000);
echo();
}
works fine on the Arduino Nano via USB to a serial terminal emulator (baud rate 9600) on the computer.
With seeduino film and the UartSBFrame programming adapter via USB to a serial terminal emulator, however, the terminal receives only garbage from the seeduino film.
Remedy: Set the baud rate to 4800.
Why??
If changing the baud rate to the next higher one, to be 19200 in the arduino code, one can then connect the terminal emulator with 9600. It seems to be always off by one - is this a known bug?
Uploading Arduino code that establishes a serial connection like this
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print("arduino greets");
delay(2000);
echo();
}
works fine on the Arduino Nano via USB to a serial terminal emulator (baud rate 9600) on the computer.
With seeduino film and the UartSBFrame programming adapter via USB to a serial terminal emulator, however, the terminal receives only garbage from the seeduino film.
Remedy: Set the baud rate to 4800.
Why??
If changing the baud rate to the next higher one, to be 19200 in the arduino code, one can then connect the terminal emulator with 9600. It seems to be always off by one - is this a known bug?
Saturday, September 24, 2011
Wednesday, September 14, 2011
Load arduino wirelessly via xbees
http://www.ladyada.net/make/xbee/arduino.html
RTS and DI03 are connected in the explorer board - to transmit the RTS signal wirelessly via the DI03 pin. The xbees have to be configured to transmit the DI03 signal.
RTS and DI03 are connected in the explorer board - to transmit the RTS signal wirelessly via the DI03 pin. The xbees have to be configured to transmit the DI03 signal.
Serial connection between two XBEEs
- plug in two xbees with USB explorer boards
- connect to the xbees via serial terminal emulator
screen /dev/tty.usbserial-A8004xAX 9600
screen /dev/tty.usbserial-A8004YWG 9600
- access xbee configuration via AT commands:
+++ -> should return OK, makes the xbee listen to commands
AT -> should return OK, now we are really sure that the xbee understands commands
ATID -> PAN id, 3332 per default, (xbees send/recieve within same PAN id)
ATBD -> baud rate for wireless transfer, 3 per default, number codes mean:
0 = 1200
1 = 2400
2 = 4800
3 = 9600
4 = 19200
5 = 38400
6 = 57600
7 = 115200
-> AT (check if xbee modem is responding)
<- OK -> ATBD (get current baud rate as above)
<- 3 (9600) -> ATBD 4 (set baud rate to 19200)
<- OK -> ATBD (check again)
<- 4 -> ATWR (write the baud rate change to flash)
<- OK
http://www.ladyada.net/make/xbee/ref.html
- connect to the xbees via serial terminal emulator
screen /dev/tty.usbserial-A8004xAX 9600
screen /dev/tty.usbserial-A8004YWG 9600
- access xbee configuration via AT commands:
+++ -> should return OK, makes the xbee listen to commands
AT -> should return OK, now we are really sure that the xbee understands commands
ATID -> PAN id, 3332 per default, (xbees send/recieve within same PAN id)
ATBD -> baud rate for wireless transfer, 3 per default, number codes mean:
0 = 1200
1 = 2400
2 = 4800
3 = 9600
4 = 19200
5 = 38400
6 = 57600
7 = 115200
-> AT (check if xbee modem is responding)
<- OK -> ATBD (get current baud rate as above)
<- 3 (9600) -> ATBD 4 (set baud rate to 19200)
<- OK -> ATBD (check again)
<- 4 -> ATWR (write the baud rate change to flash)
<- OK
http://www.ladyada.net/make/xbee/ref.html
Screen as a serial terminal emulator in MacOS X
screen /dev/tty.usbserial-XXXXXXXXX 9600
More comfortable: Apple script
tell application "Terminal"
do script with command "screen /dev/tty.KeySerial1"
set number of rows of window 1 to 100
set number of columns of window 1 to 80
set background color of window 1 to "black"
set normal text color of window 1 to "green"
set custom title of window 1 to "SerialOut"
end tell
Control-A followed by Control-\ to exit your screen
More comfortable: Apple script
tell application "Terminal"
do script with command "screen /dev/tty.KeySerial1"
set number of rows of window 1 to 100
set number of columns of window 1 to 80
set background color of window 1 to "black"
set normal text color of window 1 to "green"
set custom title of window 1 to "SerialOut"
end tell
Control-A followed by Control-\ to exit your screen
Subscribe to:
Posts (Atom)