Powering stand alone atmega328 no FTDI

Hello,

I have a circuit on a breadboard with a standalone atmega328 that works fine. I can upload sketches via FTDI and then I can disconnect the FTDI and just power the circuit with a 5V regulated supply.

I have the same circuit on a PCB and I can upload sketches via FTDI when I connect it and if I leave it on to power the at mega, everything works as it should.

If I disconnect the FTDI and try powering it via a micro USB, the sketch doesn’t run.

If I plug the FTDI (no power, just plug the FTDI in its socket) while leaving the microUSB to power the circuit, the sketch works. If I take the FTDI out of the socket, the sketch stops working.

Does anyone have an idea as to why this could be happening?

Thanks in advance for any ideas

Please post a schematic of your PCB circuit

Sounds like the reset pin is missing a pull-up.

More "creative head-banging". :astonished:

A Pro Mini is generally cheaper than a DIP Atmega328 and has all the components required to operate it from the get-go. And has two additional analog input pins. A standalone Atmega328 is an amusing "educational" exercise, but not very useful in most applications.

This will of course invoke all the inveterate stand-alone enthusiasts. :roll_eyes:

Hi, thanks for the replies, here are the schematics

Paul__B:
Sounds like the reset pin is missing a pull-up.

A Pro Mini is generally cheaper than a DIP Atmega328 and has all the components required to operate it from the get-go. And has two additional analog input pins. A standalone Atmega328 is an amusing "educational" exercise, but not very useful in most applications.

I thought about the pull up but it is there....
I made two different PCBs, one with a nano and another with the atmega... havent tried the mini but I am already doubting having chosen just the atmega... worked well in terms of space but it may indeed be more of a pain in the end

I thought about the pull up but it is there…

If you have a multimeter, I would test to see the voltage on reset. if you don’t I would remove the FTDI and put another 10K from DTR to +V

Thanks JohnRob

both with and without the FTDI I have 5V on pin1 of the atmega

in the pics, the one with the FTDI plugged, works, the other not. The FTDI is not connected at all, just plugged in the socket.

Cheers

Why have you connected AREF to VCC? :astonished:

And what are all those 1N4148s supposed to be doing?

And why have you specified antique CD4051s instead of the proper 74HC4051?

You should use 1k for the LED resistors, not 220 Ohms.

Define "stops working".
I think you are missing decoupling caps, the FTDI board adds them.

Paul__B:
Why have you connected AREF to VCC? :astonished:

And what are all those 1N4148s supposed to be doing?

And why have you specified antique CD4051s instead of the proper 74HC4051?

You should use 1k for the LED resistors, not 220 Ohms.

I connected vcc to aref because i had no idea if i could just leave it unconnected. Didnt make any difference when i tried and using the code i have. Do you think this is the reason of the problem?
The diodes solve some weird note lingering i was having when the sequencer was going from one step to the next. Do yyoyou think this is the reason?
The CD4051 work as they should. Do you think this is the reason?
The 220 ohms is from tons of examples i have seen with every arduino and raspberries. Even in official docs i have seen. It works. Do you think this is the reason?

Smajdalf:
Define "stops working".
I think you are missing decoupling caps, the FTDI board adds them.

The thing is a sequencer for a synth library. When i say stops working I mean the code stops. No more sequencing. Only one LED stays on and there is no sound and no ssequencing of the LEDS.
I am not sure what the decoupling capacitors are or where I should put them in the circuit. Could you please tell me more about this option?

None of my four comments is likely to stop the microcontroller as such.

The omission of bypass capacitors is serious, there should be a 100 nF ceramic directly between Vcc and ground of each logic chip. On your current PCB, you can solder them underneath the board.

AREF is internally switched to AVCC by default in the analog read code, but you can select other sources such as the internal 1.1 V reference which is generally more accurate. But if you actually did that (which of course, you wodul not :grinning: ), you would be shorting that reference to the 5 V supply. For this reason, AREF is not connected to anything other than the appropriate board pin on the Arduino design.

The CD4051 has a switching resistance of nominal 470 Ohms, nearly six times the switching resistance of the 74HC4051. This means that you are putting this resistance in series with the 220 Ohms to the LEDs and substantially dropping the voltage you apply to the potentiometers. I should be somewhat surprised if you were getting analog readings greater than 700 from those potentiometers or in fact, greater than 500 if that, with the diodes in series. I would expect the diodes to make the readings more unstable.

When you switch from one multiplexer input to the next, it may be a good idea to do one analog reading and ignore it, read a second time for the stable reading.

Using a 74HC4051, the switch resistance is only about 80 Ohms, but even that will mean the voltage to the potentiometer is pulled down by the 220 Ohm LED resistor, so increasing that to 1k reduces the effect. Given the switch resistance of the CD4051 is already limiting the LED current substantially, I suspect you would notice no difference in brightness changing both IC and resistors, but you should get vastly better responses from the potentiometers. :sunglasses:

montythepython:
When i say stops working I mean the code stops. No more sequencing. Only one LED stays on and there is no sound and no sequencing of the LEDs.

But the fact that one LED goes on to start with does tend to imply the code did actually start to do something - or is the actual LED chosen a random thing because the control inputs are floating?

Try connecting some capacitor between Vcc and GND of the FTDI. Try what you have (if any) and see if it helps. You probably need a large "bulk" capacitor (i.e. 100 uF aluminium electrolyte) or "high speed" ceramic cap (at least 100 nF).

Thank you Paul_B for all that info, I will have that in mind for the next round of PCBs... the thing really works fine and on the protoboard for some reason I don't have the issue I am describing here... have no idea why it works well on the proto but not on the PCB.

Thank you Smajdalf, I will try adding the capacitor when I get home and report back!

Actually, I will double check i don't have the issue on the proto. I may have always tried with the ftdi connected...

Will check when I try the capacitor Smajdalf suggested.

It is possible there is more capacitance between traces on the protoboard hiding the issue.

Smajdalf! That did it!
I put a 100nf cap between vcc and ground in the ftdi socket and it works.

Same was happening on the proto but I hadn't noticed because I was always leaving the ftdi connected to the wires and was disconnecting just the mini USB.

What would be the way of having this circuit work without plugging the cap when I don't have the ftdi? Is it OK to HAVE the cap AND also connect the ftdi?

Paul_B, I think the LED was turning ON because the code started but then stopped.
Next version I will try without the diodes and adding the cap between vcc and ground on the chips. What could happen if I don't have this cap?

Regarding the 4051s I have a bunch, so after I use them, I will order the 74HC4051.
I have seen this "74HC..." "prefix" before also replacing the "CD.." on other chips. Is it something I can count on as a general rule that next time I see the 74HC version, I should get that instead of the CD?

I am new to this and I have no electronics background. Already got some issues between unbuffered and buffered chips for other projects.... also did the same getting some 555 timers instead of the tlc555...

Update on the caps in the ftdi socket:

If I leave only a 100nf it works for a while and then freezes... I added another 47nf and it doesn't have the issue

montythepython:
Regarding the 4051s I have a bunch, so after I use them, I will order the 74HC4051.
I have seen this “74HC…” “prefix” before also replacing the “CD…” on other chips. Is it something I can count on as a general rule that next time I see the 74HC version, I should get that instead of the CD?

The “CD4000” series is basically obsolete. Its only remaining application is where you need to operate at 10, 15 or in the case of the CD405x devices, as much as 20 Volts.

Whereas the 74CH4051 operates at 5 V and you can also connect “VEE” to -5 V and use it to switch a signal of nearly 10 V peak to peak, the CD5051 is rated for double those voltages. But as in your case, for almost all applications, it will be operated at 5 V logic levels so the vastly improved performance of the 74HC4051 as I explained above, is simply more practical.

I am sure your circuit using the CD5051 does work, but not very well. :astonished:

montythepython:
Next version I will try without the diodes and adding the cap between vcc and ground on the chips. What could happen if I don’t have this cap?

I am not sure what you are asking. You have already discovered what can happen if you omit the bypass capacitors. Was that not the whole reason for your question in this thread? :roll_eyes:

Hi Paul_B,

Thanks for the clarification on the CD4000 series. I do have projects ongoing with 12V so I will make sure I check this next time I need to get chips.

Regarding the cap and logic chips, I may have misunderstood what you meant by adding the cap between VCC and ground on the logic chips.

My problem was not solved by adding caps to the "chips"(CD4051s). I didn't add any caps there... I also didn't add a cap between VCC and ground to the ATmega.
When you said it was serious to omit the cap between Vcc and ground on logic chips, I understood you were talking about the multiplexers and the atmega.

What solved my problem was to add caps between Vcc and ground on the socket where I was connecting the FTDI.

Did I misunderstand what you meant by "logic chips"?