Notifications
Clear all

Arduino resistor testing

51 Posts
5 Users
7 Likes
4,069 Views
(@davee)
Member
Joined: 3 years ago
Posts: 1608
 

hi @will & @jeffreyjene,

Well done for getting your circuit to reliably measure voltage. I assume you were careful to ensure the voltage seen by the ADC was always less than 4V, even though you were powering your voltage divider by 6V or 9V.

Of course, many practical circuits have much higher voltages present than can be coped with by microcontrollers, and providing the high voltage and microcontroller are suitably separated there is no problem. However, when experimenting it is easy to miswire something or for a probe to slip. Hence, if the entire circuit can function at a low voltage, the consequences of a mistake are often much lower.

Thanks Will for clarifying .. I wasn't saying it would cause damage ... merely that it might, since applying a higher voltage to the ADC than its reference is outside of the range of voltages it is designed to cope with.

----------

It may be useful to note that chips will often survive small overvoltages, but they may still be 'weakened' by the experience. As an analogy, if you bend a piece of steel then you may well be able to bend it back to look 'almost new' - however if you bend back and forth a number of times it is likely to weaken and snap. So the closer you keep to recommended limits the lower the chance it will fail.

----------

Another point, if a logic circuit, such as an Arduino, has two different 'power sources', and those power sources are indepedently switched on and off, then the circuit might get locked in a weird state.

In your case, if you are measuring a battery voltage via a voltage divider, then the Arduino needs both the battery and the power to the Arduino board to function correctly.  

If the battery and divider are connected to the voltage input, whilst the Arduino supply is off, it is feasible that it could draw sufficient current to partially power the Arduino from the battery! This can mean that when the 'proper' power to the Arduino is restored, it is unable to function properly and you might see strange behaviour.

In most cases, removing all sources of power, then reconnecting the 5V supply to allow the Arduino power up normally, before connecting the battery, will 'fix' the problem.

This might be the reason your circuit gave different results on different occasions.

----------

To expand upon this point, in some cases, it is possible for sufficient current to flow through the 'wrong' internal components of the chip to actually cause damage. The chip data sheets will often give advice as to what is permissable in terms of the need to apply power in a particular sequence. In the absence of such advice, a 'rule of thumb' might be to ensure the 'power input' pins, such as VCC+0V are powered before the others like data, analogue, control and so on. In particular, watch for non-power input pins being driven by a low impedance source that could supply more than a milliAmp or so.

If your circuit has only one source of power, this situation usually becomes much easier to manage!

-------------

Good luck with the next phase of your project!! Dave


   
ReplyQuote
(@jeffreyjene)
Member
Joined: 4 years ago
Posts: 56
Topic starter  

@Will and @DaveE thanks for the advice guys. I've gotten tired of fooling around with this part of the project (which feels like it shouldn't have taken more than a day), and I'm going to try an ADS1115 module for an ADC. Hopefully that will smooth some issues over and make things a bit safer and tidier. Besides, this project is suffering from "feeping creaturism" as game programmers call it. One moment it's a simple meter panel, next it'll be doing all that PLUS broadcasting the news or weather or something else. I need to get my project parameters set here.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1608
 

Hi @jeffreyjene,

 OK ... hope you got something useful out of the exercise, and maybe you will want to return to it after a break ... it should all be fun anyway, so if it stops being fun for a while, a break is often a good way to go.

I could see you were making progress, but there is a lot to take in at first.

Good luck in your overall project .. hope to 'chat' again!

Best wishes and take care, Dave


   
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

Hi @jeffreyjene,

I've been monitoring your post for a little while now so, I think I have a solution for you to get where you want to go with this project.

I'm new to this site, but not to electronics in general, so using my TinkerCad simulator, I've come up with a circuit that will demonstrate how you can test for an unknown resistor.

The test resistor I'm using for RX is a 1k ohm in the simulator.. they are all marker on the attached dwg. that is attached to this post.. I'm also working on a version that has a keypad input to change the range, and a current sensing module to provide the necessary current the divider loop required to calculate the current through the divider network, as this will change when you select a different range.

This sketch uses those resisters tied to pins 10,11,12,13 to provide feedback so the program knows which switch has been selected, then uses pre-calculated values in variables  float I200, I2k, I20k, or I200k.

Good luck, and let me know how it works out for you.

Regards,  Inst_Tech

 

LouisR


   
ReplyQuote
(@jeffreyjene)
Member
Joined: 4 years ago
Posts: 56
Topic starter  

@inst-tech Fantastic, thank you! I'm going to give it a shot. I'll let you know.


   
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@jeffreyjene 

I have reviewed the last post I sent you and found a problem with using digital pin 13 in my scheme, and changed the layout of the feedback switches , sw1- sw4 to dpst instead of spdt..I have revised the code to reflect reassignment of the digital pins. This was done as I suspect that because pin 13 also utilizes an on board led, that using a pull resistance of 10k pulled the voltage down to below 2 volts, and thus not allowing the current from variable I200k= 0.00002487 to be selected.. sorry I didn't catch that the first time around..But I'm using  a simulator from TinkerCad, that's what you are looking at on the circuit layout..saves a lot of "letting out the smoke" when designing circuits..and saving components!  Highly recommend using a simulator like this one. 

Attached are the new files for code and circuit layout.. good luck with your project

regards,

Louis

 

 

 

LouisR


   
ReplyQuote
Page 4 / 4