Loading...
 Pages: [1]   Go Down
 Author Topic: How can you use a 9.6V external circuit for a pin input to Arduino mini?  (Read 285 times) 0 Members and 1 Guest are viewing this topic.
San Diego
Offline
Newbie
Karma: 0
Posts: 2
 « on: July 08, 2011, 03:16:44 am » Bigger Smaller Reset

I am attaching an Arduino Mini to a toy rifle in order to use it in conjunction with a computer game.  The Arduino Mini will detect a trigger pull and then send a message to fire a "bullet" in the game.  I believe the input voltage value for pin 3 must be 5 volts (not sure if the amps matter in this case).  The trigger/switch is attached to an existing 9.6V 1600mAh battery-driven circuit that must remain intact (it is not an option to make the switch 2 pole or remove the existing circuit that is driving other weapon functions).  The battery charge actually ranges from 9 to 11 volts, depending on charge.  From the forum posts, a voltage divider is a valid course of action, but I am not certain of the resistor selection.  The equations are giving me weird values that I would like to have validated with more experienced folks...

Question 1 - Due to the battery voltage variation, what would be the best wattage and resistance values for R1 and R2 for this use case to stimulate pin 3?

Question 2 - Does anything look stupid in the diagram as illustrated?

Question 3 - Is there a better method of doing this, or does a voltage divider work as good as anything?
 « Last Edit: July 08, 2011, 03:19:57 am by Gronkle » Logged

0
Offline
Tesla Member
Karma: 71
Posts: 6617
Arduino rocks
 « Reply #1 on: July 08, 2011, 05:47:43 am » Bigger Smaller Reset

Voltage divider will work - try 10k for the lower half and 15k for the upper half - that will multiply the voltage by 0.4, so 11V goes to 4.4V, 9V goes to 3.6V, both will register as logic HIGH.

The 330ohm resistor in your diagram is completely weird - take it out.

You need to common the ground rails for both circuits or it won't work (a circuit is exactly that, a circuit - joining two things by one wire isn't going to allow a current to flow!)

There is an issue of motor generated noise on the external circuit - one possibility is to add a capacitor of a few hundred pF across the bottom of the voltage divider.  The 15k resistor should protect pin 3 anyhow, the capacitor will reduce the chance of noise-induced spurious switching on pin3 (if you use this as an interrupt source this will matter).
 « Last Edit: July 08, 2011, 05:51:38 am by MarkT » Logged

San Diego
Offline
Newbie
Karma: 0
Posts: 2
 « Reply #2 on: July 08, 2011, 01:22:35 pm » Bigger Smaller Reset

I will try the the 10 and 15k resistors and take a look at the voltage.

The intent of the 330ohm resistor was to replicate the "pull down down" resistor from other Arduino tutorials (image).

"If you disconnect the digital i/o pin from everything, the LED may blink erratically. This is because the input is "floating" - that is, it will randomly return either HIGH or LOW. That's why you need a pull-up or pull-down resistor in the circuit."  ("http://www.arduino.cc/en/Tutorial/Button")

Looking at the schematic, do you still think 330ohm resistor is useless in this role?

Are you saying that running a jumper wire from the negative on the 9.6V battery to the USB ground is a good idea?  Shouldn't the 3.6 to 4.4 volts from the voltage divider flow to the ground present on the USB?

So I can replicate the work, what equation were you using to get 3.6 and 4.4?
 Logged

Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3464
 « Reply #3 on: July 08, 2011, 03:01:22 pm » Bigger Smaller Reset

Quote
Looking at the schematic, do you still think 330ohm resistor is useless in this role?
After you make the required connection between the battery minus and GND the 330 ohm resistor is worse than useless.  It will completely mess up the voltage divider because it will be in parallel with R2.

Quote
So I can replicate the work, what equation were you using to get 3.6 and 4.4?
Ohm's law, twice for each calculation.

When battery is 9 Volts:
I = E / Rtotal = 9 / (10K + 15K) = 9 / 25K = 0.36 mA
Vout = I x Rout = 0.36mA x 10K = 3.6V

When battery is 11 Volts:
I = E / Rtotal = 11 / (10K + 15K) = 11 / 25K = 0.44 mA
Vout = I x Rout = 0.44mA x 10K = 4.4V

Don
 « Last Edit: July 08, 2011, 03:11:11 pm by floresta » Logged

Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3464
 « Reply #4 on: July 08, 2011, 03:17:42 pm » Bigger Smaller Reset

You really should rethink the entire circuit since the noise from your motor will probably keep the circuit from working reliably.  You might have better luck using an opto-isolator rather than a voltage divider.

Don
 Logged

 Pages: [1]   Go Up
Jump to:

© 2011 Arduino Forum: