Using RX & TX on Standalone Atmega chip

Hey,

I am attempting to move my project from the Arduino board to a standalone circuit board and have got everything to work the far with the exception of the serial communication.

I am using adafruit's bluetooth chip to communicate from my laptop to the chip, everything worked fine when I was using the arduino board but for some reason cannot get it to work by itself.

I know the bluetooth module is sending the right information to the pin but I'm unsure why it is not reading any of it. Any help would be greatly appreciated!

Here are a few pictures of the set up. I have triple checked all connections and not sure what else to do.

For now I am just trying to get that LED to turn on.
Thanks!


I am attempting to move my project from the Arduino board to a standalone circuit board and have got everything to work the far with the exception of the serial communication.

Absolutely sure your fuses are correct?
You can use AVRDUDE and ArduinoISP to interrogate them or simply put your standalone uC in the working Arduino board... If it still works, it is your wiring or a component on the breadboard or perhaps the breadboard itself!

Ray

mrburnette:
Absolutely sure your fuses are correct?
You can use AVRDUDE and ArduinoISP to interrogate them or simply put your standalone uC in the working Arduino board... If it still works, it is your wiring or a component on the breadboard or perhaps the breadboard itself!

Ray

Hey, sorry what fuses are you referring too?

I bought the Atmega from spark fun with the Arduino Optiboot preloaded : ATmega328 with Arduino Optiboot (Uno) - DEV-10524 - SparkFun Electronics

I placed that chip into the arduino programmed it and then removed and placed on the breadboard.

I will give another breadboard a try. However, I tried the following and it was getting the right values: Placed another wire at D0 on the breadboard and read it through the arduino serial monitor and it was working. But the standalone arduino was not responding to the commands.

Sorry btw, I am more mechanically inclined, and not familiar with a lot of the terms. All my Arduino knowledge has come from online.

I bought the Atmega from spark fun with the Arduino Optiboot preloaded :

Should be OK. A "fuse" is an area in flash that controls functions of the microcontroller such as internal or external oscillators signals, brown out detection, boot loader size, and many others.

Breadboards can be a problem from loose or dirty connections.

While using the Arduino as a USB to serial converter works, be sure you are using the correct lines for send & receive... Then double-check by looping send back to receive... Called a loop-back. You use the PC terminal to make certain you can type and receive.

Ray

mrburnette:
Should be OK. A "fuse" is an area in flash that controls functions of the microcontroller such as internal or external oscillators signals, brown out detection, boot loader size, and many others.

Breadboards can be a problem from loose or dirty connections.

While using the Arduino as a USB to serial converter works, be sure you are using the correct lines for send & receive... Then double-check by looping send back to receive... Called a loop-back. You use the PC terminal to make certain you can type and receive.

Ray

Thank you very much for the explanation!

I switched to another breadboard and still had no luck. After a few hours moving the chip back and forth I got it to work.

I initially only connected the VCC & GND pin on the left side. I then saw some tutorials suggesting I also connect the GND, AREF,AVCC as well, with the GND going to GND and the other 2 to +. This got the bluetooth working with a simply LED program and will try it with my program tomorrow.

However, I would love some more background as to why everything started working when I connected the other 3 pins.

Edit did some more playing around and in order to get everything working I just need to have connected to AVCC. However, a lot of forums are saying not to touch these pins without a lot of reason as to what it does. Any information on it would be greatly appreciated :slight_smile:

From what I understand you need to connect the power and ground on both sides of the 328. See the shrimp kit here for example.

In your original picture you only have one sides power connected.

Also missing some basics:
No 10K reset pullup resistor
No 270, 330,that kind of range, current limit resistor on the LED
No 0.1uF decoupling caps on VCC, AVCC.
Aref - do not connect to 5V - only add a 0.1uF cap to Gnd.

All the power (VCC, AVCC) & gnd pins need to be connected to provide power & gnd to all portions of the die inside the package.

AtmelAVR042 AVR Design Considerations.pdf (236 KB)

ChilliTronix:
From what I understand you need to connect the power and ground on both sides of the 328. See the shrimp kit here for example.

In your original picture you only have one sides power connected.

Thanks! Yeah I was not aware of that.

CrossRoads:
Also missing some basics:
No 10K reset pullup resistor
No 270, 330,that kind of range, current limit resistor on the LED
No 0.1uF decoupling caps on VCC, AVCC.
Aref - do not connect to 5V - only add a 0.1uF cap to Gnd.

All the power (VCC, AVCC) & gnd pins need to be connected to provide power & gnd to all portions of the die inside the package.

Thanks for the input! I am learning as I go. I understand the need for the 0.1uF caps, however I have been having trouble finding them locally or am looking for the wrong thing. Would you be able to tell me if this would work? http://www.canadarobotix.com/electronic-components/100nF-50v-radial-ceramic-capacitor-5-pcs

And is it ok to connect the VCC & AVCC to the same capacitor and to power? As well as connect both the ground to one cap and to GND?

Is the reset button absolutely necessary? I plan on putting the project onto a solderable breadboard and space is very limited. As of right now everything just fits.

Would you be able to tell me if this would work? http://www.canadarobotix.com/electronic-components/100nF-50v-radial-ceramic-capacitor-5-pcs

And is it ok to connect the VCC & AVCC to the same capacitor and to power? As well as connect both the ground to one cap and to GND?

Is the reset button absolutely necessary? I plan on putting the project onto a solderable breadboard and space is very limited. As of right now everything just fits.

The caps on the link provided are adequate.

It is not good practice to utilize only 1 bypass cap, use two and get the caps as close to Vcc and AVcc as possible with each going to the closest GND pin.

Reset is optional. The 10K pullup is very cheap insurance that static or stray electrical discharges will not cause an unintended reset - use it.

Ray

mrburnette:
The caps on the link provided are adequate.

It is not good practice to utilize only 1 bypass cap, use two and get the caps as close to Vcc and AVcc as possible with each going to the closest GND pin.

Reset is optional. The 10K pullup is very cheap insurance that static or stray electrical discharges will not cause an unintended reset - use it.

Ray

Thanks again! Did not realize that is what the resistor was for, will add it in. Looking at the schematic CrossRoads posted, the resistor just goes from reset to 5v?

Having 2 capacitors is going to be tricky, I wanted to run 5V on one set of rails and 6V-9V on the other for my motor and servo. Might have to get a larger breadboard!

Lastly, just to confirm that I am reading the schematic CrossRoads posted correctly. I have one capacitor going from VCC to +5V & the common ground. Another capacitor going from AVCC +5V & to the common Ground and lastly one capacitor going from AREF to Common ground.

Thanks again for all the info!

I don't know if this occurred to you but an ATmega328 programmed in an arduino UNO does NOT use the same bootloader UNLESS it is going to be used WITH the external xtal and 18pf caps. Since you are not using those, your fuses need to be set for INTERNAL, which is not the same bootloader used on the UNO.

Yes. The larger cap is a bulk capacitator while the 100nF are bypass... That is, high frequencies are "grounded" or significantly attenuated. Thus helps to keep high frequency from digital switching in the IC from being "seen" ... Which is why they should be near the chip pins.

Bulk capacitators are DC filter capacitators that store energy and attentuate ripples from low frequency AC rectification. We want them near the IC for their storage capability, so that when the uC draws more current, the bulk cap can deliver same and thus avoid that current from having to travel the path of the DC supply. In a perfect world the DC path would have 0 (zero) Ohms, but reality is that this path has resistance and a voltage-drop will occur. Do, the bulk cap helps to minimize voltage drop (or it stabilizes) the DC supply.

Ray

raschemmel:
I don't know if this occurred to you but an ATmega328 programmed in an arduino UNO does NOT use the same bootloader UNLESS it is going to be used WITH the external xtal and 18pf caps. Since you are not using those, your fuses need to be set for INTERNAL, which is not the same bootloader used on the UNO.

Op's pix in post #1 shows a 16MHz resonator.

But, you are 100% correct that fuses must be changed to run @ 8MHz with thee internal RC osc. There is a menu item in the GUI for doing this whole loading the correct bootkoasder & fuse settings.

Ray

mrburnette:
Yes. The larger cap is a bulk capacitator while the 100nF are bypass... That is, high frequencies are "grounded" or significantly attenuated. Thus helps to keep high frequency from digital switching in the IC from being "seen" ... Which is why they should be near the chip pins.

Bulk capacitators are DC filter capacitators that store energy and attentuate ripples from low frequency AC rectification. We want them near the IC for their storage capability, so that when the uC draws more current, the bulk cap can deliver same and thus avoid that current from having to travel the path of the DC supply. In a perfect world the DC path would have 0 (zero) Ohms, but reality is that this path has resistance and a voltage-drop will occur. Do, the bulk cap helps to minimize voltage drop (or it stabilizes) the DC supply.

Ray

Sorry I think we misunderstood each other at some point.

When you say 2 capacitors you mean 1 that is 0.1uf and one that is 10uf? But I can have both VCC & AVCC connected to these 2 capacitors? I don't need a set of capacitors for VCC & AVCC?

raschemmel:
I don't know if this occurred to you but an ATmega328 programmed in an arduino UNO does NOT use the same bootloader UNLESS it is going to be used WITH the external xtal and 18pf caps. Since you are not using those, your fuses need to be set for INTERNAL, which is not the same bootloader used on the UNO.

I was under the impression that the chip purchased from sparkfun, with the Optiboot loaded on it had everything set and ready to go to use it as a standalone?

When you say 2 capacitors you mean 1 that is 0.1uf and one that is 10uf? But I can have both VCC & AVCC connected to these 2 capacitors? I don't need a set of capacitors for VCC & AVCC?

Just follow the schematic. You are not building a commercial instrument. Tie Vcc & AVcc together. Use a single bulk cap and a single bypass. It will work. Just know that more sophisticated designs exist and are important when ADC have bit resolution > 1024.

You purchased a 328 chip for bareboard Arduino OR Uno replacement. The boot loader is the 16MHz one. Were you to build an 8MHz bareboard, the boot loader can be replaced and they fuses must change. You are not doing this. Forget about it.

Ray

mrburnette:
Just follow the schematic. You are not building a commercial instrument. Tie Vcc & AVcc together. Use a single bulk cap and a single bypass. It will work. Just know that more sophisticated designs exist and are important when ADC have bit resolution > 1024.

You purchased a 328 chip for bareboard Arduino OR Uno replacement. The boot loader is the 16MHz one. Were you to build an 8MHz bareboard, the boot loader can be replaced and they fuses must change. You are not doing this. Forget about it.

Ray

Haha thanks a lot! I moved things around so as to get power on both sides to be 5V. So as of now, my board looks like this. Could you confirm the capacitors are placed in the right places?

Looks OK... Only 1 bulk cap is required however... Vcc side. The position of your 2 bypass caps are good, but switch them for the location of the bulk cap... That is, even closer to IC.

Here is what I was stating early:

Look how Nick did the 2 bypass caps! ( I personally prefer them closer to the IC). Nick did not need a bulk cap since the Arduino has one in the regulator circuit.

Here is one of Crossroads prototype boards:

Look at the bypass caps on both sides of the UC socket!

Ray

mrburnette:
Looks OK... Only 1 bulk cap is required however... Vcc side.

Here is what I was stating early:
http://www.gammon.com.au/forum/?id=11637

Look how Nick did the 2 bypass caps! ( I personally prefer them closer to the IC).

Here is one of Crossroads prototype boards:

Look at the bypass caps on both sides of the UC socket!

Ray

Thanks for the link!

That placement makes much more sense and it frees up space on the breadboard.