I know a lot of topics are kind of similar to my questions, but I couldn't figure out how to make my circuit works even when following the different advice from older topics.
I'm working in a lab where we have to shock mice when they touch an obstacle. The main circuit is quite straightforward. We have an obstacle with interdigitated fingers; when the mouse walk on the obstacle, it closes the circuit and a shock is sent. The stimulator that we use is composed of 5 rods. We hook two of the rods to our system and set the stimulator to an output curent of 0.1mA. Depending on the load of the system (the paw's resistance of the mouse), the output voltage of the stimulator can easily reach 300 V.
Our goal is to have a signal (in this case a buzzer) to alert us when the mouse touches the obstacle. The main idea is quite simple: we put a test resistor in serie of the obstacle. When the mouse close the circuit, a voltage drop across the test resistor should be measurable. (cf attached schematic: R_t).
I added a voltage divider before entering the analog input of the arduino as the voltage are way higher than 5V. The value of R1 is approx. 3950 and R2 is 50 Ohm. (these values were chosen to have an input value in the arduino of 5V when the stimulator reaches 400V, in theory the stimulator should never reaches this value).
Unfortunately, a problem arose when I took a close look at the stimulator. The two rods, that we hook our circuit to, are floating voltage, ie none of the two rods is the true ground, so I cannot tie the Arduino ground to the main circuit ground. This is quite a big problem for me, because when I try to plug my arduino and read the voltage, I have values even if the circuit is open (mouse do not touch the obstacle).
I don't know if any of you already faced this problem or not? Is it possible to read a voltage drop across a resistor if I can't tie the grounds from my arduino to the main circuit one.
I power my Arduino uno using my computer, in order to read the value of the voltage drop across the test resistor. The signal sent by the stimulator is a biphasic square signal repeating itself every 50ms if the system is closed.
If I wasn't clear or you need more information, let me know in the comments!
Many of the Atmega chips (but NOT the Atmega 328 ) have the ability to measure the voltage differential between two analog pins and, provided the differential is less than 5v and provided the voltage sources is NOT coupled to Arduino GND it does not matter what the absolute voltage is. However this feature is not part of any of the convenient Arduino libraries.
Many of the Atmega chips also include amplifiers that can be used to boost a very small differential voltage - for example across a low ohm resistor.
Having said all that, it seems to me a simpler solution would be to build a simple circuit with an OP amp used as a comparator to generate a 5v signal when the input signal exceeds some threshold. That way the high voltages are well away from the Arduino.
Hello C,
Welcome to the forum.
You say the outputs are not grounded, is the stimulator grounded? If not, then you are struggling without some form of isolation. If the stimulator is grounded then you can measure the o/p voltage with reference to its ground, and from your description you need to do it on both outputs and compare the result.
Ditch R_t
Connect R_1 and R_2 (A1) to the lower output
Leave R1 and R_2 (A2) where they are
(Please, on your next diagram give your resistors unique identifiers, so R1, R2, R3, R4)
3950 and 50 ohms is too low for 300V, at that voltage they will have 7.5mA (75 times what you are shocking your mice with) and their load will swamp the load you are measuring. They will also dissipate 22.5W, which is rather a lot. I suggest a total resistance of around 3M Ohms would be more reasonable, I leave you to calculate the values.
You can "float" the ground. That means there is no (other) outside connection to the Arduino's ground. No USB connection and no power supply ground. And for safety, the Arduino should be enclosed in an isolated/insulated case.
That's how a battery powered multimeter works... The negative side of the battery is (probably) internal ground and the black/negative/common terminal is (probably) internal ground. You can reverse connections (connecting the red probe to external ground or earth ground) and DC voltages will simply read negative. And of course bench top DMMs have an isolated supply and if there's a USB (or other) connection it's optically isolated, etc.
I plug my stimulator to the outlet wall, so I guess I could use the ground from my outlet. I'll try @PerryBebbington solution first (sorry for the identifiers, I didn't pay too much attention when doing it...).
@Robin2, to be sure I understand your 2nd solution: I would just have to connect the input of my OP amp comparator to the node before the obstacle? right?
I plug my stimulator to the outlet wall, so I guess I could use the ground from my outlet.
I need to clarify that I meant is the internal circuitry of the stimulator grounded? Just because there is a ground connection from the wall socket does not mean the output wires are referenced to it, they might be floating. This is important in choosing how you proceed.
c_charles:
I would just have to connect the input of my OP amp comparator to the node before the obstacle? right?
I don't feel comfortable answering that question partly because I am not sure what you have in mind and partly because I am not an expert on Op amps. I suggest you do some Googling to learn about op-amp circuits.
I've been wondering how to reply and what to suggest if you said that, and I can't think of a helpful answer. I would need to see the stimulator and play around with it. Hopefully someone else has a better answer.
Even if the stimulator is floating, the bottom plane of the experiment can be and IMO should be grounded.
I also wonder how much difference a mouse makes to the sensor resistance. Eventually a capacitive sensor or AC current would allow for better hit detection than only DC.
I applied @perrybebbington idea, but I adapted the total resistance of my voltage divider. If the resistance is too low (around 3M Ohm) the stimulator sends a current (it makes sense as the paw's resistance is around 3 to 4 MOhm), so I just adjusted the total resistance of my voltage divider to 10.5 MOhm. I'm also powering the arduino with a battery and the circuit seems to work. When the mouse touches the obstacle, the voltage drops between the input and output of my circuit.
I guess that the internal circuit of the stimulator is grounded somehow? The company wasn't really helpful and couldn't give me a proper circuit design unfortunately...
"Grounded" WRT a device can only mean mains ground. In so far also an Arduino is not grounded, unless its power supply is. If the company does not document otherwise, you can connect either connection to some other ground, and so convert a floating circuit to a grounded one.
I don’t see where the duration of the pulse is defined anywhere and I cannot envision how an analog input is going to catch a very short pulse with any predictability.
High voltage low current pulse? I’d be thinking a neon lamp to a photo transistor firing a small SCR. Good old fashioned analog.