Pages: [1]   Go Down
Author Topic: trouble with arduino standalone circuit and xbee  (Read 483 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have an application that sends data from 1 XBee connected to a computer to another Xbee connected to a microprocessor(ATMEGA328P-PU). I programmed the program into the microprocessor using a arduino board and everything work as programmed on the board itself. However, when brought over to connect everything on the breadboard, it is not working as programmed. I tried loading the microprocessor with a simple blink led program and it works on the breadboard. What is wrong?

What I've connected to the microprocessor on the breadboard: pull up resistor between pin 1 and vcc DataOut and DataIn to rx and tx of microprocessor VCC to pin 7,20 and 21. Gnd to 8 and 22 20Mhz crystal with 2 22pF capacitors to pin 9 and 10.

I've tested communication between the 2 xbees using x-ctu and they are communicating properly.

Thanks in advance for your help!
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26447
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why the change from 16 MHZ to 20 MHz?  That will change the data rate between devices.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That is because I do not have access to 16Mhz crystal as the supplier does not have stock and i have a 20Mhz crystal on hand right now. Could it be because of the crystals that i am unable to run the program as per normal ( as in on the arduino board). Thanks for your reply!
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26447
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, if one side is sending at 9600 * 20/16, or 12000, and the other side is receiving at 9600, then that could be a problem.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks a lot for your help. My transmitting side is transmitting at 9600 baud rate and my receiving side is the xbee with the 20Mhz crystal. I've change my program from serial.begin(9600) to 7680 ( 9600 x 16 / 20) and it seems to work. Is there however any hidden issue with me changing the value to 7680. Once again thank you for your help!
Logged

UK
Offline Offline
God Member
*****
Karma: 17
Posts: 568
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you haven't set the 20Mhz MCU up properly then everything will be running 25% faster; all your timers etc, which will affect PWM, millis(), micros() etc. You'll end up with other problems of a similar nature.

To save any other issues you should either get yourself a 16Mhz crystal or configure the MCU properly to run at 20Mhz so all the dividers are set properly and correct timing is restored.

If your sketch is using any kind of timing at the moment then every 1ms you expect is only going to be about 0.8ms really.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The only issue would be the timing issue? I'm not going to use anything regarding time except for delay() and I dont really need it to delay for exactly 1 second for example. I'm going to source for the 16Mhz crystal soon. Thanks for all your help.
Logged

Pages: [1]   Go Up
Jump to: