Converting from 5v Arduino to 3.3v - Component verification help please

Hi All,

I am moving code from a 5 volt Arduino to a Pro Mini 3.3v clone from Gikfun.

I am not really good with electronics and components but the info I found seems to suggest I will need to change some parts so they play well at 3.3v. With that in mind I reduced all the resistors down to 100 Ohms. The LEDs used to be at 330 Ohms and the one connected to the transistor was 1K.

Everything is working OK, but I want to make sure that I don't damage the XBee radio or the Pro Mini.
Could you all let me know if the schematics / components are OK or suggest replacement values for what is wrong.

thanks in advance.

Both the LEDs and the NPN transistor are current-driven devices. So you might to select the resistors so you get the same current through the LEDs and through the transistor's base as you did at 5V.

You would need to determine the voltage drop across an LED, which varies by color. If they are red, that would be about 1.8V. At 5V, red LED current was:

(5 - 1.8 ) / 330 = .0097A = 9.7mA

At 3.3V, it is now:

(3.3 - 1.8 ) / 100 = .015A = 15mA

So you are now drawing more current than you did at 5V. You might try changing them to 220 ohm resistors and see if the LEDs are still bright enough. Generally, you want the highest resistor values that still produce enough brightness.

At 5V, the transistor base current was:

(5 - .6 ) / 1000 = .0044A = 4.4mA

Now at 3.3V, it is:

(3.3 - .6 ) / 100 = .027A = 27mA

which is way too much, and just wastes power and heats up your Mini. A 560 ohm resistor should be plenty. In fact, leaving it at 1K would also probably work.

I confess I don't understand what your Schottky diode circuit is all about.

Be aware that some push button contacts have a minimum current requirement. I have had some push buttons that will not work or only work intermittently with just the internal pull-ups of a 3V3 system. If that is the case with you then you will need external PULLUP resistors.

Is there a reason for the 3 diodes on the press buttons, considering you aren't multiplexing them?

Also gnd switching the Bee?

Tom.... :slight_smile:

Thank you so much for the comments.

The Schottky diodes idea was given to me by another member of this forum, Blackfin.
They are connected to pin 2 which as an interrupt routine to monitor for any button press.
My understanding is that the diodes keep each button isolated from the other while still "linking" them to the one interrupt pin.

The ground switching of the XBee seemed like an easy way to power up or down the external device while the system sleeps. It gets powered up by the ISR routine that runs when a button is pressed.


My understanding is that the diodes keep each button isolated from the other while still "linking" them to the one interrupt pin.

You misunderstood what he was telling you.

Using an interrupt for a button press is a rubbish idea, a mistake beginners often make.

The interrupt only sets a flag and your code checks for the flag. So you might as well just check the pin instead of the flag.

@Grumpy_Mike, I thought the interrupt would allow me to sleep the Arduino and just use the button press to wake it.
If I just poll the pin, doesn't that mean that I read it during the main loop, so the Arduino almost never sleeps ?

This unit is very much like a TV remote, so it could go hours without any button being pressed.

In terms I can understand... everyone is sleeping, there's a knock at the door, I wake up and go see who is there - that's what I thought the interrupt does, compared to spending the whole night going to see if someone is at the door every 2 seconds.

thought the interrupt would allow me to sleep the Arduino and just use the button press to wake it.

Yes it would, see what happens with incomplete information.

You still don’t need those diodes however. As the switches go into the same input then the buttons must be wired in parallel, you won’t be able to find out from the code what button was pushed, only a button had been pressed.

Sorry I noticed I never responded to the latest posts here.

One side of the button is to ground, the other side goes to its own digital pin (5, 6, 7) and also to pin 2 via the Schottky diodes so the "wake ISR" can detect any button press. Then the main loop reads pin 5, 6, 7.

Using interrupt for button processing is a good idea especially if you need to wake up by button event. You just need to do interrupt processing carefully. For example - disable button interrupt after first one. Do polling and enable it back when debounsing done.

That is somewhat confused!

The interrupt wakes the processor. The first action is to disable interrupts. The polling routine then discerns which button has been actuated and de-bounces it. When it is time to sleep again, you re-enable the interrupt.

Use PCINTs to wake processor on button press, and do away with the schottky diode rigmarole, IMO

IMO PCINTs are better suited to this application in general (and you don't have to turn them off when not sleeping either, and often an empty ISR is fine)