I am in the process of designing an Arduino-powered device that will interface between two other devices. The logic is pretty simple: it will need to wait for the first device to ‘short’ a connection (similar to pressing a momentary-release push switch), and then it will output two signals to the second device (via optocouplers). I know the second device will be protected by using optocouplers and no direct voltage will flow to it, however the only way to ‘read’ the first device will be to sense when it completes a circuit (which as far as I know requires sending voltage to it as if it were a switch).
My desire is to protect this device as much as possible. I will be using the 3.3V Arduino Pro Mini (unless someone suggests another device). I am familiar with programming logic (including C), though am not very familiar with the electrical engineering aspect of micro-controller programming. I have read about pull-up and pull-down resistors being used with switches to ensure the proper reading is obtained when there is no input at the switch.
I am curious as to which is a safer means to connect to the first device (that in essence is an automatic switch), and should I be using a diode or other form of protection to prevent any excess voltage from entering the device? I am guessing pull-up as it seems the 3.3V is connected to the device only when the ‘switch’ is being pressed, but do recall something about electricity actually flowing backwards so want to get the opinions of others with experience and knowledge. (if there is another way to ‘read’ the device such as how an optocoupler ‘writes’ to a device, please let me know)
Below are two images of both pull-down and pull-up connections from the Arduino to the device being read (the output device optocouplers/resistors are not drawn). I apologize for the lack of standard schematic symbols - I have not had a chance to learn Eagle or another program yet. To see standard conventions illustrating what I am questioning, please look at Fig 5.5 and Fig 5.6 at http://ladyada.net/learn/arduino/lesson5.html
Another question is can the Arduino Pro Mini provide +3.3V power or does this need to be wired directly to the battery with this board? Speaking of battery, what will be an effective (preferably lightweight and long-lasting) battery solution to power the 3.3V Arduino (plus resistors you see in the drawings and 2 optocouplers/resistors not in the drawings)? It will most likely be powered on for around two hours at a time, and I’ll attach an on/off switch to the battery to power down when not in use. I have to study the capabilities/functions of the chipset - if supported, I’ll be using interrupts or other routines to save power consumption while waiting for the first device to ‘send’ its signal. (Does the Arduino Pro Mini board consume more power than something like an ATtiny25V chip with the basic necessary components?)
Typically you want to keep both devices, the uController and the Other device, referenced to ‘ground’. So a pull-up is the better choice.
This also allows to use of other protection devices such as TVS’s or caps to smooth transients.
How far away is the ‘other device’? If it is not on the board with the arduno then do add addition protect where the leads connect to the arduino board.
I like rechargable batteries such as NiCad or NiMH. It is best to do a power budget to determine how long a battery will last, or what size battery is needed to last a specific period of time.
Which would be better in my case, the TVS or cap? In my diagram on the right for the pull-up scenario, would the TVS diode go between the other device and GND (pointing in the direction to allow voltage to flow from the other device to ground)? What rating should the TVS diode have in order to be effective? Would a tvs or cap be useful between the other device and the 10kohm or 100ohm resistors?
The other device will be about a foot or two away from the new microcontroller device I’m creating. The other device accepts a DIN5/6 plug which I’ve soldered an old RCA cable (stereo / mono+video, with a magnet coil near the microcontroller end) to allow a plug into the new enclosure with the microcontroller.
How many NiCad/NiMH batteries would you suggest for the 3.3V Arduino? (are these AA?)
A TVS and a cap do different things. A TVS clamps fast spikes like a static discharge. A cap and resistor slows the switch response, RC time constant. This can help ‘de-bounce’ a switch.
The 100 Ohm resistor should be close to the processor’s pin. The TVS, 5V rating, goes from the junction of the 10K pull-up and the 100 Ohm resister to ground, Arrow point to the resistors.
Is there a 3.3Volt regulator on the Arduino board? If not then one should be added since a battery’s voltage drops as it discharges. I usually use four cells in series (nom 4.8V) with a low drop out 3.3V linear regulator.
Thanks again waltr for your help! I downloaded Eagle and played around a bit to create this (please forgive any issues with it - this is the first schematic I’ve ever designed):
Is that where the TVS should go? Is the diode I have between the jack for the external device and ground offering additional protection? Is the 1N4001 or 1N4004 a good choice here?
I do believe the Arduino has its own 3.3V regulator when one plugs in the battery to the RAW pin. As I am new to microelectronics, I have a basic question about wiring the pull-up resistor going to the external jack on the left side of the schematic: is voltage usually obtained through the VCC pin of the microcontroller board, or is it better to wire this directly to the battery (through my own voltage regulator)? (the same for ground: should this be through one of the GND connections on the Arduino board or should it be directly to the battery ground?) Also, I saw the 540 ohm resistor for the optocouplers on another example project: is this a good choice for my setup, and how does one properly calculate the resistance required?
Does anyone know a good source for diodes, jacks, optocouplers, resistors, etc that Sparkfun doesn’t carry? Does anyone know if a TRS connector is offered as a male plug rather than a female jack? (I’m looking for a part that can work well in an enclosure, not the standard TRS connector one can get at Radio Shack for cables)
I’m still working on figuring out the best solution for batteries. I really would like something that weighs less than AA’s. I may consider the 1100 mAh or 2000 mAh rechargeable lithium polymer that Sparkfun sells if the AA cells don’t work for this project.
I just realized that Sparkfun’s Arduino Pro 168 - 3.3V/8MHz contains the ATmega168V while the Pro Mini 328 - 3.3V/8MHz is not listed as being the ‘V’ version. Is anyone familiar with the power savings in the ‘V’ versions of the AVR processors, and how much difference in power one can expect between the regular chip and the V chip (both running at 3.3V)? Would using a regular Pro board with the ATmega168V chip save me a lot of battery life versus the Pro Mini with the ATmega328 chip? I’m still curious how to calculate and optimize battery draw… A simple project at http://www.doc-diy.net/photo/hdr-jack2/ uses the ATtiny25 chip with a CR2032 battery and estimates battery life of 200000 hours. I realize it lacks the optocouplers and input device, but if I could get even 1000-2000 hours on a coin size battery, I’d be very happy! This project can use a larger battery if necessary, though I have another project where I want to create a very simple interval timer that fits inside a DIN5/6 connector if possible (or if it must protrude to hold the battery, does so as minimally as possible).