NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » measuring high voltage and current

August 27, 2015
by escartiz
escartiz's Avatar

Can someone suggest me ideas or a chip or components required to measure up to 200v DC with current up to 30A. with the nerdkit. Would a simple resistor divider do the job at this high current? I have been looking for samples using arduinos and some already made boards to ADC but none seem to measure this high

Thanks in advance

August 27, 2015
by sask55
sask55's Avatar

Firstly and most importantly I feel I should point out that 200 volts is a dangerous and potentially lethal amount of voltage. You should only consider working with this level of voltage if you are certain you know what precautions to take to protect yourself and your equipment.

Just to clarify, do you want to measure the current draw as well voltage level at the supply or are you only concerned with measuring the voltage level?

If the voltage level is all that you are looking for, the current draw would be irrelevant. That is, a 200 Volt supply is 200V. The level of current it is capable of supplying or is currently supplying is not a factor in the voltage measurement. For example a 12 Volt heavy duty battery may be capable of delivering well over 1000 amps for a short period of time. It requires no special considerations or hardware to measure the voltage output of that battery at any current level. The same voltage measuring device or system can be used when the battery is producing no current (zero amps) or when it is producing its maximum current during a near dead short condition.

So what are you intending on measuring voltage current or both?

August 27, 2015
by escartiz
escartiz's Avatar

Hi Sask55

Thanks for the reply. I am aware of the risk and I am taking the necessary precautions. One of my concerns is exactly that, choosing components rated at the appropriate level to interact with the nerdkit without damaging it.

I need to measure both. Voltage aswell as Amps. The nerdkit will make multiple actions switching relays and optos and displaying results to the lcd and serial depending on the amount of current flowing. basically I like to switch from a constant current and constant voltage supplies and choose current rates depending on voltage.

So basically for voltage a resistor divider would work just fine for the voltage part regardless of the current is currently supplying. To be on the safer side I am thinking 1k on the positive and 39k on the negative to scale 200v to 5v, Although 170v is closer to the max I plan to see before switching it off. Do you think this values are enough? Does wattage and percentage make a huge difference? I have some 1/4 and 1/2 watt 5% but I can buy 1% and maybe higher wattage if needed.

For the AMPS part, I found this shunt on ebay but I have no clue if this would work, my understanding is I need to scale to 75mv aswell but remain clueless of the procedure

August 28, 2015
by sask55
sask55's Avatar

Hi escartiz

I think I would consider using hall effect current measurement sensors. I have used several different types with very good results but always on AC power lines not on a DC application. The advantage would be that the output voltage that the micro is reading is isolated from the voltage on the line that you are reading. I may also consider using optical isolators on the voltage measurement side of the system. This would add a high degree of isolation for your low voltage electronics.

As far as your voltage divider goes. Built as you propose if you are going to use a common ground between the nerd kit board and the high voltage power then a 1K resistor from ground and the 39 K resistor too the positive high voltage would be a total of 40 K. I =V/R so the current thru the resistors would be 200/40000 = 5 mA. The voltage drop on the 39K resistor would be .005 X 39000 = 195 volts. The wattage of heat on the 39K resistor would be 195 X .005 = .975 watts. So either you should used larger values for your resistors to reduce the current draw or you will require resistors that can handle more heat then .5 watt. I would likely use 10K and 390K resistors in your voltage divider if I was considering doing it this way.

The level of your resister precision will only be a factor in the accuracy of your readings. 1% resistors are more likely to be closer to there stated values and therefore your measured output is more likely to be closer to what you calculate it to be. A 5% 39K resistor will have a accrual resistance within 5% of the stated value which would be a possible variance of about the same value as the 1K resistor.

perhapes there is someone else that has used a voltage measuremnt chip for this kind of application and can make a recomondation.

August 28, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

Let's back up a bit. This is a design question. As such, we need to understand more about what you're trying to do. Where is the 200VDC coming from-- is this a bench supply, or could be anything (wall outlet, bench supply, etc)? And you expect not more than 30A?

In every event, you must put a fuse in. For your safety and it can save your components, too.

My question isn't idle, it matters because in some situations the only reason voltage would ever vary is if current demand was beyond what could be supplied, so voltage would collapse.

BM

August 28, 2015
by scootergarrett
scootergarrett's Avatar

My method for measuring high currents like when I was testing my car battery cranking the engine is to use a current clamp. This type of solution is nice because you don't need to tap into anything for current at least. But its expensive. As for the voltage I'm thinking along the lines of a voltage divider like mentioned before, and I have the same concerns if the 200V source and the Nerd kit have a common ground.

August 28, 2015
by escartiz
escartiz's Avatar

Sask55 thanks a lot for the formulas to calculate wattage of the resistor, I just made an excel sheet for future calculations :)

I was reading that high input impedance will generally pick up more noise than a low input impedance. Would switching to 10k / 390k affect the adc more or less than 1k / 39k?

BM I did get already a few bussmann fuses for the dc side and a gfci for the ac. I want to control charging phases for large li-ion packs. The already made chargers are to expensive and something at a decent price lacks many features that shortens the life of the batteries. That is why I like to make my own monitoring system. I am currently charging manually using a simple constant current capacitive charger for the first stage and then switch to server power supplies in series for the constant voltage for the final stage at which current drops continuously until fully charge.

Doing it this way works fine but is time consuming and requires my full attention all the time. A monitoring nerdkit would help me take a brake doing the transition between stages automatically plus making sure individual cells stay balanced. I am also considering charging both stages only with the server power supplies but this are rated at up to 50a and I don't ever want them to charge at more than 30a for the safety/longevity of the batteries but if the pack get deeply discharged voltage would drop enough to push the power supplies to provide that much amperage and eventually shut down. That is why it is very important to keep measurement of both voltage and current to take decisions appropriately.

August 28, 2015
by BobaMosfet
BobaMosfet's Avatar

Just general input-- a 'current clamp' is just an induction coil. On side of the coil is split, which represents the open end of the plier. When you close the plier around a cable, it reconnects that side of the coil.

escartiz-

Li-ion packs are a bit risky, and require special handling. There are pressure factors here, and from a design standpoint, you want to create a circuit that generates both a constant current and a constant voltage, in various phases.

Personally, to ensure your success with this, I would strongly urge you to consider utililizing a Li-ion/Li-Po Charging IC. Maxim, Microchip, Intersil, TI, and others make vary good ones, and you can find what you need in the quantity you need for the price you need. You would likely need one chip for every 2 cells you are charging, but, it simplifies your entire problem significantly.

These ICs can manage trickle, fast, maintenance and even undercharge states for the cells.

BM

August 28, 2015
by escartiz
escartiz's Avatar

BM thank you very much for the suggestions I did have looked at plenty and I do have a bms (battery manage system) for the individual cells. It is the charging method that I like to simplify as already made "chargers" designed for the purpose are way to expensive $2k-$4k and using other more affordable power supplies can do the same job, most of the IC like the maxims and the likes take care of the process of balancing, maintain and discharge, then they simply send and on off signal to the power supplies "chargers" but designing the charging also requires the use of transformers and other components that make them very expensive. I think that my approach of using servers power supplies is not so bad as this are very well designed power supplies with lots of research to back them up and I think they are even more reliable at a way more accesible price then the cheaper chargers that start at over $800 at the lowest charging rate and without displaying what is going on, you just have to trust them and all I am looking after right now is switching them on and off which is something the NK is capable of doing i am sure plus the benefit of having an lcd and show what is going on. I know it might not be the best approach but I have been doing the simple task manually for a few months with around $100 worth of parts and consider it simple enough for the nerdkit to handle it as long as it is aware of the voltage and current to switch relays on and off accordingly. Later on I plan on more features like serial communication to the bms, etc but I don't know if I will ever get it developed that far as there are other options I am aware off. For know all I like to accomplish is having the NK measure up to 30a. At the end I might not end up trusting it but I like to do some testing and learning.

I was able to test the voltage divider and it works just like sask55 suggested and voltage is displayed very closed to my voltmeter, I might still need to do things maybe in the code to make it more accurate, it is off by a few volts when measuring lower voltage and gets more accurate at higher voltage. At least I have a clue now, i had used deviders before for other smaller projects but never at this voltage :)

now I am looking at the amps part, I found some hall effect and premade boards for arduinos but so far the highest is rated at 60v 30a. I also found this amplifier and some samples that suggest scaling Up the 75mv from the ebay shunt to a value the NK can read

August 28, 2015
by sask55
sask55's Avatar

Escartiz

When considering the nature of what you are doing in your project I would have to agree with BobaMosfet. I think he has mentioned some valid points

I do not know much about charging Li-ion batteries but I know that things can go bad even when using charging systems that are professionally designed and built for that specific purpose. It would seam to me that you should consider making use of charging chips as BobaMosfet has suggested.

As far as a higher impedance resistor divider is concerned, I do not know how much of an effect it would have on noise to the ADC. It might be an interesting little project just to determine the stability of the output with various levels of impedances on resistor dividers.

August 28, 2015
by escartiz
escartiz's Avatar

I don't think that AD8211 amplifier would to the trick either, I fount this on the data sheet "The AD8211 rejects high common-mode voltages (up to 65 V) and provides a ground-referenced, buffered output that interfaces with an analog-to-digital converter"

September 01, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

Thank you for the clarification. If you're already satisied with your management capability and just want to measure current and voltage so you can act on the values, then really it's a question of scaling 200V and 30A into what the ADC can handle -> 5VDC.

The voltage divider solution is ideal for scaling voltage, as you are scaling the value and the current down to something the ADC can handle. I normally try for about 1mA into the ADC, but using your above numbers we get:

Vi = 200
R1 = 390K-Ohm (it's largest, because it's dropping the most voltage)
R2 = 10K-Ohm

Vo = Vi * (R2/(R1+R2))
Vo = 200 * (10000 / (390000+10000))
Vo = 200 * 0.025
Vo = 5

But how much current is that? Will it exceed what the ADC can handle?

Well, restating the voltage divider formula as I = E/R, we see that:

Io = Vi / (R1+R2)
Io = 200 / (390000+10000)
Io = 200 / 400000
Io = 0.0005 (or 500uA)

So that won't overpower the ADC. The reason I wanted to answer that is because you asked a question about impedance. Impedance is confusing to a lot of people. It deals with both resistance and reactance. Formulas, Graphs and all that-- gets kinda hairy if you don't understand it. So here's the skinny-- it's all about resisting the flow of current. Reactance uses a field, resistance uses friction, and impedance uses both.

So if someone says a 'high impedance', they mean high resistance allowing little current to flow (so it's easily affected (relatively speaking)). If they say 'low impedance' they mean low resistance, so lots of current is flowing, so it's harder to overcome by electromagnetic influences. Amplifers can boost small signals-- but they also boost the noise, and then you have to filter it or do other things-- it gets messy.

It's better to, in your case, to rely on a high-impedance signal (and 0.5mA is not really all that weak in signal terms) and put grounded traces around that signal trace to act as shielding (you probably don't need it), than to go through the other mess of boosting and filtering.

As for current-- why not see if you can create your own inductive sensor using as imple coil around the conductor you wish to monitor. There are many calculators on line to help you learn about and create a coil the size and shape you need-- this would let you scale the output to 5VDC for 0-30A and is very affordable. This is the method most clamp/inductive ammeters use, anyway.

BM

  • Apologies if any mistakes; pinched on time here at work.
September 01, 2015
by JKITSON
JKITSON's Avatar

BM

Thanks for a good refresher on ohm's law. Learned all this in the early 60's but do not use it much any more. Very nice explanation.

Jim

September 02, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

How many cells do you have, and what is the voltage for each cell? What is the battery output in volts and amps, please? Do you know the 'Ah' or 'C' rating for a battery or cell?

BM

September 03, 2015
by escartiz
escartiz's Avatar

BM thanks for clarifying impedance, I order this sensor before reading your post, the seller said it would work fine with 200v or more but tomorrow I will try to build my own coil. Currently the pack is 90ah total, I charge them aprox at 0.3 C even though cells are suppose to be able to charge up to 1C. But I read that lower is healthier plus getting more amps out of the chargers is already difficult. each cell is 3.7 nominal (4.1 fully charged)

September 03, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

You're welcome. Slower charge is better. You can safely go up to 0.8C, per most OEMs, but I wouldn't go above that. How many cells are there, and do you know what a single cell's Ah or Wh is (if they are all the same)?

BM

September 03, 2015
by escartiz
escartiz's Avatar

240 cells total, each cell is 15ah and I have 6 in parallel and 40 series for the pack plus 35 more cells but I haven't install those yet, I will either increase voltage or add 15ah for a total of 105ah whenever I can get 5 more, they are all the same cells. It is a large pack that is why I am having trouble finding an intelligent charger at a decent price and the reason for trying to make one my self

September 04, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

Are these laptop batteries with about 20 cells inside each battery? 3.7V @ 15Ah (55.5Wh) sounds like a laptop battery... And you're saying you have 240 of these?

BM

September 04, 2015
by escartiz
escartiz's Avatar

No, this are pouch cells, each individual is 15ah, I have 275 :)

September 07, 2015
by escartiz
escartiz's Avatar

I got the sensor from ebay, it came with a sheet with the following specifications.

Volt increase per 1 amp = 0.0185

Output reading = 2.481v at 0 amps

I also got 10k and 390k 1% resistors and I wrote this in the while loop:

volt_sample = adc_read(5);
temp_avg = volt_sample * (200.0/1024.0);

amps_sample = adc_read(0);
ampVoltage = (amps_sample / 1024.0) * 5;
amp_avg = ((ampVoltage - 2.481) / 0.0185);

lcd_home();
lcd_write_int16(volt_sample);
fprintf_P(&lcd_stream, PSTR("/1024 %.2f"),  temp_avg);
lcd_write_string(PSTR(" Volts"));

lcd_line_two();
lcd_write_int16(amps_sample);
fprintf_P(&lcd_stream, PSTR("/1024 %.2f"), amp_avg);
lcd_write_string(PSTR(" Amps"));

Testing at 140volts on my multimeter the display is off by 20 volts reading 169.11 volts, 865 steps. I check the resistance on both resistors and multimeter reads 9.95k and 388k

testing at 0 amps it reads 0.26 amps and 428 steps, I applied around 5 amps according to my multimeter and the lcd displays -3.80

definitely my code is wrong. Voltage was a closer before adding the amps to adc 0 part but I dont know if this is related.

I tested the output of the 7805 and it reads 4.85v. I changed this with no improvement

ampVoltage = (amps_sample / 1024.0) * 4.85;

I am sharing the ground but powering the NK with a different power supply, should I try to power it from the first two cells? I wonder if it is a voltage reference issue. Please advice

September 07, 2015
by sask55
sask55's Avatar

escartiz

I have some questions and ideas that may help to narrow down the possible causes of the unexpected readings.

Disconnect the ADC input pins from their connections to the amperage sensor and the battery voltage divider and then ground the ADC input pins. What is the resulting output on the LCD screen under those conditions?

What is the LCD readout if the ADC input pins are connected directly to the Nerdkits 5 volt supply voltage?

When there is no connection to the ADC from the current sensor and no current flowing thru the sensor, what is the voltage that you measure from ground to the sensor output pin using a high impedance volt meter? Does that voltage level change when read with the multimeter when the sensor output is connected to the ADC input pins?

When the ADC is not connected and there is a current flowing thru the sensor. What voltage do you read on the sensor output pin with your multimetre? Does that voltage level change when read with the multimeter when the sensor output is connected to the ADC input pins?

When the resistor divider is not connected to the ADC and you are applying a high voltage to the divider, what is the voltage you read at the ADC input pin with your multimeter? Does that voltage level change when read with the multimeter when the resistor devider is connected to the ADC input pins?

I am just attempting to establish and verify the ADC readings at the upper and lower limits of the input voltage range and to determine what voltages are actually being applied to the ADC under certain conditions. All this may help establish if the variations in the expected readings are a result of the input single level not being what you expect or if it is a case of the ACD and software not displaying the level that is being applied to the input pins.

I would consider some degree of signal averaging to help smooth out noise that may be on the ADC. Perhaps a loop to run several hindered consecutive reads then take an average as the displayed values. Such a change should not add any perceivable delay in the system but would likely be more stable readings

Darryl

September 08, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

Unexpected readings: Do something more basic-- when you don't understand something, fall back to something you do or can understand and prove. In this case, don't go to the ADC right away; prove your shunt works as expected first.

Briefly, because I'm at work, first-- your LM7805-- it's fine. Everything in electronics is designed to work within an envelope-- one of the hardest things for noobs to realize. Everything is yin yang between resistance and current. Give one, take from the other. Take one, give from the other. In other words, the LM7805 is designed to offer a relatively stable, close to 5VDC against a range of load impedance. If you don't put a load on it, it can't go to that extreme to regulate the voltage. Datasheet will tell you what the minimum load is for regulation.

Now, instead of going to the ADC, and because the figures you got provided by the vendor seem complete wack, test your shunt. It's just a metal bar of some highly conductive material, of a large enough size to handle up to 30A of current through it without frying. If this is the same shunt you first mentioned, you should see a voltage drop (aka loss) of 75mV across it when 30A of current goes through it. or in a linear fashion, 0.075mV/30A = 0.0025V (aka 2.5mV) per Amp through it. Figure out a way to put a 5-Ohm, 10W resistor in series with the shunt, and then connect it to your LM7805 for not more than say 10-15 seconds. That should put 1A through the shunt. Use your multimeter (if it's got a DC Volt miliVolt range) and see how many volts a dropped between the test points on the shunt. Should be close to 2.5mV.

Then you've proven your shunt, and you know it works.

Hope this helps

BM

September 08, 2015
by escartiz
escartiz's Avatar

I actually got the hall effect sensor instead of the shunt

Disconnect the ADC input pins from their connections to the amperage sensor and the battery voltage divider and then ground the ADC input pins. What is the resulting output on the LCD screen under those conditions? -Grounding the ADC pins I get 0/1024 0.00 volts and 0/1023 -133.41 amps

What is the LCD readout if the ADC input pins are connected directly to the Nerdkits 5 volt supply voltage? -at 5v I get 1023/1024 199.80 volts and 1023/1024 136.60 amps

When there is no connection to the ADC from the current sensor and no current flowing thru the sensor, what is the voltage that you measure from ground to the sensor output pin using a high impedance volt meter? -with no connection to the adc the sensor outputs 0.101 volts to the voltmeter (ground to sensor ground, red to sensor middle pin)

Does that voltage level change when read with the multimeter when the sensor output is connected to the ADC input pins? -when connection to ADC it still reads 0.101v

When the ADC is not connected and there is a current flowing thru the sensor. What voltage do you read on the sensor output pin with your multimetre? Does that voltage level change when read with the multimeter when the sensor output is connected to the ADC input pins? -voltage stays 0.101v

When the resistor divider is not connected to the ADC and you are applying a high voltage to the divider, what is the voltage you read at the ADC input pin with your multimeter? Does that voltage level change when read with the multimeter when the resistor devider is connected to the ADC input pins? -the divider outputs 3.50v either connected or not connected to ADC

September 08, 2015
by escartiz
escartiz's Avatar

I have also changed the code to average 100 samples on both ADC, I suspect the hall effect sensor is defective as there is no change on voltage

    volt_avg = 0.0;
    for(i=0; i<100; i++) { //voltage measurement
      volt_sample = adc_read(5);
      this_volt = volt_sample * (200.0/1024.0);
      volt_avg = volt_avg + this_volt/100.0;
    }

    amp_avg = 0.0;
    for(i2=0; i2<100; i2++) { //current measurement
      amps_sample = adc_read(0);
      ampVoltage = (amps_sample / 1024.0) * 5;  // steps to volts
      this_amp = (ampVoltage - 2.468) / 0.0185; // voltage - offset / mvperamp
      amp_avg = amp_avg + this_amp/100.0;
    }
September 08, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

I beg your pardon-- you did get a transducer, not the shunt. These values now make sense.

Volt increase per 1 amp = 0.0185
Output reading = 2.481v at 0 amps (ie. Quiescent)

Output of a hall-effect sensor is normally a DC sign wave (if pulsed), with the 'zero' at about 2.5 volts (ideally). So polarity in one direction is 0-2.5V, and polarity in the other direction is 2.5-5V. If there is no pulse, then the voltage should just go up or down, depending on polarity and stay at the value until power is removed from the inductor being sensed.

BM

September 09, 2015
by BobaMosfet
BobaMosfet's Avatar
  • 'conductor being sensed.'

BM

September 09, 2015
by escartiz
escartiz's Avatar

I had to contact the seller of the sensor to get a replacement as it is not reading anything close to 2.5v but instead it reads 0.101v at the signal output with or without current flowing. He will be sending another one.

In the mean time I was trying to make a coil around a washer with two 100k resistor in series, middle to one side of the coil and one resistor to ground and another to 5v, the other end of the coil to the voltmeter. I get 2.5v but it did not register anything either. I guess it is only acting as another divider. This side of the coil would go to the adc as suggested on an arduino tutorial but since I am not getting anything in the multimeter I am not going to even try to connect it to adc. Ill just have to wait for the hall effect sensor.

For the voltage measurements should i try a different formula in my code to get it more accurate?

I tried to do

((adc steps/1024)*5.0)/0.0256 //resistor ratio

but it still reads on the lcd like 20v more than the multimeter

September 09, 2015
by escartiz
escartiz's Avatar

Sask55

I just try this with same results :(

(volt_sample * 0.00488) * 40; //steps x voltsperstep x voltage ratio

I have tested all formulas at 139.8 volts on the multimeter and the lcd keeps displaying 855/1024 166.99 volts

multimeter measures 3.5v at the divider but 855 steps according to my math is more like 4.17v which would read 166.99 volts so all three formulas would work. How come I am getting adc_read = 855 when I am only getting 3.5v out of the divider. I have also tested with another multimeter and re check the value of the resistors. Grounding the adc gets me 0/1024 and 5v 1023/1024. Do you guys spot something I am missing?

September 09, 2015
by sask55
sask55's Avatar

Escartz

Using the values you have posted you could make a few quick calculations. I will run thru the basic calculation to determine your expected values and resolution of measurements.. Keep in mind that these calculations give the theoretical values, the actual values for your measurements of resistance current and voltage may not necessarily be what your millimetre is indicating. All instruments will have some degree of error and often the level of precision in the displayed measurements exceeds the accuracy by a wide margin.

If we except that you multimeter is displaying accurate measurements.

9.95K + 388K = 398K total resistance thru the resistor divider.

9.95/398 =0.025 or 2.5% theoretical value for the voltage drop across the 9.95K resistor is 2.5% which is precisely what you where looking for.

4.85 volts is the VCC voltage you measured. The ADC will divide that VCC voltage into 1024 equal sized increments 4.85 /1024 = 0.00474 Volts/ step, would be the theoretical resolution of the ADC.

The resolution of the total voltage on the resistor voltage divider..00474/ 0.025 =0.189 volts /step.

You measured 140Volts with the multimeter. 140/0.189 = 740 steps would be the expected value for the number of steps returned by the ADC. However you are getting a value of 865 steps returned from the ADC. Clearly this discrepancy is not do to an error in your code after the ADC has returned a value. It appears to occurs in the hardware before the ACD reads the voltage or in the way the ADC is initialized before each read is carried out. .

You measured 3.50Volt drop thru the 10K with the multimeter on the voltage divider. 3.5 v/ .00474 v/step = 739 steps. Again the expected number of steps is very near 740. Or to look at is another way 3.5V / 0.025 = 140 volts. So it appears the voltage divider is working as expected.

The ADC is not returning the correct number of steps to the software. The issue is defiantly in the ADC reads. Perhaps if you post your code for you ADC activation and read someone can spot an issue that can be corrrected

September 09, 2015
by escartiz
escartiz's Avatar

Sask55

thanks for confirming this, I had a headache trying to figure out where I am wrong. this is what I am using for the adc pins

void adc_init() {
    ADMUX=0;
    ADMUX = (1<<REFS0);

  ADCSRA = (1<<ADEN) | (1<<ADPS2) | (1<<ADPS1) | (1<<ADPS0);
  ADCSRA |= (1<<ADSC);
}

uint16_t adc_read(char mux) {
 ADMUX = (1<<REFS0) | mux;
  ADCSRA |= (1<<ADSC);
   while(ADCSRA & (1<<ADSC)) {

  }
  return ADCW;
}
September 09, 2015
by escartiz
escartiz's Avatar

it works now :)

I want to apologize for being so stupid, I decided to check continuity on all connections of the breadboard. i had a jumper between pin 20 (avcc) and pin 21 (aref) and another jumper from 5v to pin 20 (avcc). It turns out this jumper wasn't providing 5v. I put new jumpers from 5v to pin 20 and pin 21 and it work just like expected. It now reads 140.01v on the lcd and 139.8v on the multimeter. I need to get me a new breadboard. Again sorry for wasting your time. I spent countless hours trying to figure this out and the answer was right in front of me. Can't wait for the current sensor to arrive to keep working on this.

September 10, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

I hope the replacement current sensor works better. If it has 3 pins, it should not be just a coil-- it's actually a coil wrapped around the toroid (a portion of it) and a hall-effect sensor to sense the EMF change.

Technically, you should be able to register a voltage change through the toroid, simply by passing a strong, natural magnet through the core (or into and back out).

BM

September 10, 2015
by sask55
sask55's Avatar

You are welcome

Good to hear it is now working now.

It would be safer and less likely to damage or destroy the electronic on the nerdkit board if you could eclectically isolate the board completely from the high voltage battery circuits.

If a connection to ground on the low side of your voltage divider ever went bad there could potentially be 200 volts applied to the ADC pin. That would certainly destroy the micro and could be dangerous. I believe this could be avoided by using an optical coupler in between the two circuits. I am preoccupied at this time and cannot take the time to investigate in detail. Linearity of the signal in the optical coupler thru the voltage range you wish to measure would be the biggest issue to overcome.

I do not think it would be difficult to achieve a very safe, accurate and robust isolation with the addition of just one more chip in your system.

September 11, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

I don't know how frequently you check your voltage level with the ADC, or how you're powering the monitoring circuit-- but if it's of interest to you, you an shut down the ADC between uses to conserve power.

FYI.

BM

September 15, 2015
by escartiz
escartiz's Avatar

Bobamosfet I got the replacement sensor and it work right away, it does have 3 pins, I just had to change the code to the correct offset voltage and it worked first try. I used a drill to test it and I was able to read 4.95 ams on the lcd while the multimeter read 5 ams. :)

For this project I would like the adc to continuously monitor as long as the charging is still in progress. I haven't decide if I will power the NK from the batteries been charged or from the power supplies but once the charging is complete it will be turned off so power is not an issue. Although knowing how to pause adc for intervals does interest me for future projects. How would I go about achieving this while the system continues to do other tasks?

Sask55 I have been looking at your suggestion to isolate voltage. From what I've been reading a regular opto coupler would not work as they act more like a switch so I would need a "linear analogue optocoupler" instead. Please correct me if I am wrong. I am looking at two options, HCNR201 or IL300. I am still struggling on how to wire them if they are any good options. It seems though that I would also need to use amplifiers on both ends of the linear optocoupler.

I also came across another suggestion where supposedly I could use the same current hall effect sensor instead of the divider as it already is isolated from the high voltage and to figure out the voltage apply a formula knowing the resistance and current??? I am not quite sure how would I do that, the post did not offer any more details.

September 15, 2015
by sask55
sask55's Avatar

I don’t think you can estimate your voltage level by measuring the current flow in your battery changing application. That approach would work fine if you were delivering voltage to a more or less fixed resistance load. But this would be about as far from a fixed resistance load as I can think of. It seams to me that you require a system that monitors both the voltage and the current independently in order to know what is going on and make the appropriate adjustments.

I have used only 4N35 and H11L1M optoccouplers in the past, That type of optocoupler is designed for digital signal isolation, and as you say the output is more or less like a switch. You would require a high-linearity analog optocoupler for your application. Perhaps something like the HCNR2001 would work. Honestly I have no experience using this type of device but the information on the Data sheets I have taken a look at would indicate this type of device should work for an application like yours.

The introduction of this isolating chip would require some research and a bit of a learning curve to select a device that would operate in the voltage range you require. It is likely that you may still require a resistor voltage divider on the high voltage side of the optocoupler in order to bring the measured voltage into a range the optocoupler will accept. I believe it would be reasonable easy to completely isolate the nerdkit board and any person using it from the 200 volt source this way.

As I see it with no isolation chip the nerkit board and it components are at some risk. There would be some chance that the 200 Volts could end up energizing the board in unexpected places, possibly resulting in damage or even personal shook to the user. With the introduction of the optocoupler all that could ever be at risk would be the optocoupler chip itself, if a connection ever went bad on the voltage divider.

Since none of the components on the nerdkit board are all that expensive and you seam to be quite experienced working with the higher voltage, you may not feel the level of risk and possible potential damage is worth the time and effort to isolate the nerdkit hardware. In that event you could just take appropriate steps to electrically isolate the entire system from any users or bystanders all the time, ie treat the entire system like it may be energized to 200 volts at any time without any prior indications.

September 15, 2015
by sask55
sask55's Avatar

It has occurred to me that an additional hall effect current sensor could be used to measure the voltage at the batteries, while isolating the high voltage from the nerdkit board. You would have to place a resistor of know value in parallel to the batteries that you wish to measure voltage on. Since you know the resistance of that connection across the batteries, ohms law would be applicable. By using a hall effect current sensor to measure the current passing thru that resistor not the current passing thru the batteries being charged the voltage could be measured. A hall effect current sensor with a very low current measurement capability would be ideal for this, because you could use a high value resistor which would result in low current.

After I reliized this I was able to find on line that there are voltage transducers that do just that LV25-P for one.

Sorry for the somewhat conflicting information. I hope at least some of it is helpful or at least interesting.

September 15, 2015
by sask55
sask55's Avatar

link to LV25-P Data sheet

September 16, 2015
by BobaMosfet
BobaMosfet's Avatar

escartiz-

This is for an ATMEGA32 (project I have open at the moment), for turning off ADC. It might have similar register names for the MCU you're using.

ADCSRA &= ~(1<<ADEN);

BM

Post a Reply

Please log in to post a reply.

Did you know that you can input numbers in binary via a DIP switch, and output them to the LCD? Learn more...