Jump to content
15 minutes ago, mariushm said:

The arduino board has linear regulators along with capacitors and everything required on the board. You just need to power it with 5v or more and the board does everything else.

 

Well thanks lot's I think we finally got it yay! I know it must be hard explaining to a person who knows only little bits about circuits but I thank you for the patience. Only last thing I would ask is disregarding price what do you think is the optimal arduino for me from that bunch? 

Link to comment
https://linustechtips.com/topic/865690-reverse-varistor/page/2/#findComment-10755692
Share on other sites

Link to post
Share on other sites

From the genuine ones, there's only two. There's the DIP version (which has chips inserted in sockets) and there's a SMD version which has all chips surface mount. 

The DIP version would be better for you because if you somehow damage your chip, in theory you can buy the chips separately and plug them in the socket and program them and you have a fully working board again. You could also take them out and put them on tiny boards or whatever and connect just the pins that you want to wires. 

 

The chip on the Arduino boards is called ATMEGA328  and used to be made by Atmel but Atmel was bought by Microchip.

You can buy the chips from reputable distributors for like 2$ a piece : https://www.digikey.com/product-detail/en/microchip-technology/ATMEGA328P-PU/ATMEGA328P-PU-ND/1914589

 

The only difference between these and the one on the circuit board is that these chips are completely empty of any program.  The ones on the circuit board have a tiny "bootloader", a small program which makes "uploading" programs into the arduino easier.

 

There's tutorials and examples online which teach you how to program these empty chips with that bootloader or a bootloader made by others if you really want to.

Link to comment
https://linustechtips.com/topic/865690-reverse-varistor/page/2/#findComment-10755749
Share on other sites

Link to post
Share on other sites

38 minutes ago, mariushm said:

The arduino board has linear regulators along with capacitors and everything required on the board. You just need to power it with 5v or more and the board does everything else.

 

Well now it's just sourcing all my components and then build the thing. Obviously then I gotta find how to program it for voltage detection and control but I expect that to be pretty easy to find a guide. I use aliexpress for the other stuff... they aren't too bad. Seems like tons can be done with arduinos.... if I wanted I could probably program it so if it is over a certain voltage for too long it fires the relays that shut down the whole system and keep it shut down for a peroid of time and then start it again after the wind calms down, if the wind does not calm down then it would shut down again. How many things could I run on 1 arduino? or would I need a second one if I go to do the second plan later on. 

Link to comment
https://linustechtips.com/topic/865690-reverse-varistor/page/2/#findComment-10755803
Share on other sites

Link to post
Share on other sites

A LED is a diode which produces light. 

It's not a voltage controlled device, it's a current controlled device (the amount of light produced is proportional to the amount of current that goes through it). So, you must control the amount of current that goes through it, because if it's too much it will simply burn up.

 

The diode will start conducting electricity from a certain voltage and will actually start producing light from a very slightly higher voltage.  The forward voltage is the voltage at which the diode is completely "open" allowing to flow an unlimited amount of energy through it, if you allow it. 

For example, a regular red led diode may start to turn on at around 1.3v-1.4v and let through a trickle of energy, let's say 0.5 mA and won't produce any light but will open completely and let as much energy as you want through it from around 1.7v  - so that's the forward voltage. 

Now both these values vary from led to led, even from batch to batch, and they also drift a bit with temperature (as the led heats up, the forward voltage lowers a bit) so you never rely on that "in-between" voltage in circuits, you always use the led as all-off or all-on, not in that in-between state. You also don't use the exact number in the datasheet, which is listed at the "typical forward voltage" or "maximum forward voltage", you're a bit generous and add a bit to that.

For example, if a datasheet for a red led would say "typical 1.7v, maximum 1.9v" , i'd round it up to 2v just to be sure all the leds from an order would definitely be completely turned on at this 2v value.

 

Now when they're fully turned on, the led will allow any amount of energy to go through it - if you connect it to 2 AA batteries or a 5v adapter, it could burn up in a couple of seconds. Most tiny leds are only designed to handle up to 30-50mA and they're very bright already at around 10mA  (0.01A) ... some high brightness red leds only need 1mA to be quite brights.

So you need to limit the current going through the led some way and the easiest way would be using a resistor.

 

In your particular circuit, let's say that in the worst case scenario, you're gonna have 80v DC and that you're doing the calculations for a 2v forward voltage and that the maximum allowed current through the led is 10mA. In that case we have something like this :

 

[ + 80v ] ------------------[ resistor ] ------------[ + LED  ->|  - ]  -------- [ GND ]

 

At the + terminal, the led must  "see" 2v, so the resistor must make 78v disappear.  We have the basic law of electronics  Voltage = Current x Resistance and we also know that if one device limits the current, all devices in series will be limited to that current.

 

So applying V = I x R to the resistor , we have  (80v  - 2v )  =  0.01A x R  .... so from here R = 78v / 0.01 = 7800 ohm 

This is not a standard value, so we can go up to the next common resistor value 8200 ohm or even go up to 10000 ohm , which just means that instead of 10mA through the led, you're gonna have  78v / 8200 = 9.5mA or 78 / 1000 = 7.8mA

 

You'll want to pick this value big enough that you won't put too much current at the maximum voltage through the led, but also small enough that you'll have some current at the lower voltage .

For example, if you want the circuit to start at 45v and you decided on 1000 ohm, then the current through the led would be  (45v - 2v ) / 1000 = 43/1000 = 4.3 mA which is still enough for a  led to be bright enough (but double check the datasheet of the optocoupler)

 

It's less relevant at these low current values, but you'll also want to be careful about how much energy is dissipated on the resistor.  The formula is Power = Current2 x Resistance , so if you go with 8200 ohm and a current of 9.5mA or 0.095A , then the resistor will dissipate  0.00952 x 8200 = 0.00009025 x 8200 = 0.74005 watts, so you'll need to use a resistor rated for 1w , not the very common and cheap resistors rated for 0.125w or 0.25w or 0.4w (these are the most common power ratings)

 

The reverse voltage is how much voltage the diode (because again the led is a diode) can block if you connect the led the wrong way in the circuit. Most diodes can handle a high voltage in their forward direction (connected correctly) but only a lower voltage the other way.

For example, the cheapest 1n4001 diode (very common) can handle 50v in the normal direction, but can block only up to 35v in the other direction. It would be damaged if the voltage goes above 35v

Most leds have a reverse voltage of around 5v so you don't want to connect a led the wrong way, it would be damaged.

 

 

later edit:  the above assumed you power led from the high voltage. If it's from the arduino which has 5v outputs, then your resistor will naturally be much lower, maybe in the 330 - 1000 ohm range and the total power dissipated will be very low, so any resistor will work.

Link to comment
https://linustechtips.com/topic/865690-reverse-varistor/page/2/#findComment-10757112
Share on other sites

Link to post
Share on other sites

9 hours ago, mariushm said:

A LED is a diode which produces light. 

It's not a voltage controlled device, it's a current controlled device (the amount of light produced is proportional to the amount of current that goes through it). So, you must control the amount of current that goes through it, because if it's too much it will simply burn up.

 

The diode will start conducting electricity from a certain voltage and will actually start producing light from a very slightly higher voltage.  The forward voltage is the voltage at which the diode is completely "open" allowing to flow an unlimited amount of energy through it, if you allow it. 

For example, a regular red led diode may start to turn on at around 1.3v-1.4v and let through a trickle of energy, let's say 0.5 mA and won't produce any light but will open completely and let as much energy as you want through it from around 1.7v  - so that's the forward voltage. 

Now both these values vary from led to led, even from batch to batch, and they also drift a bit with temperature (as the led heats up, the forward voltage lowers a bit) so you never rely on that "in-between" voltage in circuits, you always use the led as all-off or all-on, not in that in-between state. You also don't use the exact number in the datasheet, which is listed at the "typical forward voltage" or "maximum forward voltage", you're a bit generous and add a bit to that.

For example, if a datasheet for a red led would say "typical 1.7v, maximum 1.9v" , i'd round it up to 2v just to be sure all the leds from an order would definitely be completely turned on at this 2v value.

 

Now when they're fully turned on, the led will allow any amount of energy to go through it - if you connect it to 2 AA batteries or a 5v adapter, it could burn up in a couple of seconds. Most tiny leds are only designed to handle up to 30-50mA and they're very bright already at around 10mA  (0.01A) ... some high brightness red leds only need 1mA to be quite brights.

So you need to limit the current going through the led some way and the easiest way would be using a resistor.

 

In your particular circuit, let's say that in the worst case scenario, you're gonna have 80v DC and that you're doing the calculations for a 2v forward voltage and that the maximum allowed current through the led is 10mA. In that case we have something like this :

 

[ + 80v ] ------------------[ resistor ] ------------[ + LED  ->|  - ]  -------- [ GND ]

 

At the + terminal, the led must  "see" 2v, so the resistor must make 78v disappear.  We have the basic law of electronics  Voltage = Current x Resistance and we also know that if one device limits the current, all devices in series will be limited to that current.

 

So applying V = I x R to the resistor , we have  (80v  - 2v )  =  0.01A x R  .... so from here R = 78v / 0.01 = 7800 ohm 

This is not a standard value, so we can go up to the next common resistor value 8200 ohm or even go up to 10000 ohm , which just means that instead of 10mA through the led, you're gonna have  78v / 8200 = 9.5mA or 78 / 1000 = 7.8mA

 

You'll want to pick this value big enough that you won't put too much current at the maximum voltage through the led, but also small enough that you'll have some current at the lower voltage .

For example, if you want the circuit to start at 45v and you decided on 1000 ohm, then the current through the led would be  (45v - 2v ) / 1000 = 43/1000 = 4.3 mA which is still enough for a  led to be bright enough (but double check the datasheet of the optocoupler)

 

It's less relevant at these low current values, but you'll also want to be careful about how much energy is dissipated on the resistor.  The formula is Power = Current2 x Resistance , so if you go with 8200 ohm and a current of 9.5mA or 0.095A , then the resistor will dissipate  0.00952 x 8200 = 0.00009025 x 8200 = 0.74005 watts, so you'll need to use a resistor rated for 1w , not the very common and cheap resistors rated for 0.125w or 0.25w or 0.4w (these are the most common power ratings)

 

The reverse voltage is how much voltage the diode (because again the led is a diode) can block if you connect the led the wrong way in the circuit. Most diodes can handle a high voltage in their forward direction (connected correctly) but only a lower voltage the other way.

For example, the cheapest 1n4001 diode (very common) can handle 50v in the normal direction, but can block only up to 35v in the other direction. It would be damaged if the voltage goes above 35v

Most leds have a reverse voltage of around 5v so you don't want to connect a led the wrong way, it would be damaged.

 

 

later edit:  the above assumed you power led from the high voltage. If it's from the arduino which has 5v outputs, then your resistor will naturally be much lower, maybe in the 330 - 1000 ohm range and the total power dissipated will be very low, so any resistor will work.

All my parts are ordered. Some extras in case of.... learning experiences aha. Only thing I'm wondering is how many inputs and outputs an Arduino can do? Could it detect multiple voltage and control multiple outputs?

Link to comment
https://linustechtips.com/topic/865690-reverse-varistor/page/2/#findComment-10759017
Share on other sites

Link to post
Share on other sites

It has multiple input / output pins. It depends on the microcontroller used - the default one used in the most common Arduino (Arduino Uno R3) is a chip in a 28-PDIP package meaning it has 28 pins.  Two of those are for voltage, one or two are for other things (programming, optional clock etc) and the rest are usually input / output pins.

Some of those are digital only ( they're either on or off, where on means the chip outputs 5v or whatever the input voltage is on that pin) , or they can detect if there's some voltage or not (reading 0 or 1 into the program, 1 if the voltage on that pin is higher than some threshold, probably around 1v )  and some pins can be switched to analogue when needed (they can measure the voltage level on that pin).

You can't make simultaneous measurements from multiple inputs but you can loop through multiple analogue input pins and measure the voltage on each pin and then do something in the code with those values.

I don't know exactly how fast the Arduino chip is at measuring voltages but it should finish one measurement in milliseconds. Sometimes you take multiple measurements within a second and do an average to be more accurate, in situations where the voltage fluctuates a lot around some value.

 

See https://store.arduino.cc/usa/arduino-uno-rev3

 

Quote

Arduino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started..

 

Link to comment
https://linustechtips.com/topic/865690-reverse-varistor/page/2/#findComment-10759065
Share on other sites

Link to post
Share on other sites

1 hour ago, mariushm said:

It has multiple input / output pins. It depends on the microcontroller used - the default one used in the most common Arduino (Arduino Uno R3) is a chip in a 28-PDIP package meaning it has 28 pins.  Two of those are for voltage, one or two are for other things (programming, optional clock etc) and the rest are usually input / output pins.

Some of those are digital only ( they're either on or off, where on means the chip outputs 5v or whatever the input voltage is on that pin) , or they can detect if there's some voltage or not (reading 0 or 1 into the program, 1 if the voltage on that pin is higher than some threshold, probably around 1v )  and some pins can be switched to analogue when needed (they can measure the voltage level on that pin).

You can't make simultaneous measurements from multiple inputs but you can loop through multiple analogue input pins and measure the voltage on each pin and then do something in the code with those values.

I don't know exactly how fast the Arduino chip is at measuring voltages but it should finish one measurement in milliseconds. Sometimes you take multiple measurements within a second and do an average to be more accurate, in situations where the voltage fluctuates a lot around some value.

 

See https://store.arduino.cc/usa/arduino-uno-rev3

 

 

I was just looking to do like..hits 48v start dumping... hits 70v for x seconds, activate a different output. It would measure the the voltage of 1 input but control 2 outputs. According to your post it seems this should be no issue

Link to comment
https://linustechtips.com/topic/865690-reverse-varistor/page/2/#findComment-10759522
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×