PIC programming

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Analog read isolation

My original thought was to use common ground with Arduino and tap right off the voltage divider network but I think it's best to keep the microprocessor isolated from the tube amp supplies. That being said, should I use an LDR or an optoisolator for the analog read from my voltage divider network? Any examples out there from others?
I purchased a Voltage Detection Module from Ebay last week, but not sure exactly how this module works(description is vague).

Edit:
After reading some more, the opto isolated input is not linear....
Is it save to just ground the Arduino to common grounds and use my divider network? I may install a 4.9v zener to ground at the divider to protect the Arduino input.


A7BF_1_20150205206263765.jpg
 
Last edited:
Hi,
Normally what I do for reading high voltage it is the used of a unity gain op amp as interface between the high voltage and the micro. If something catastrophic happened the op amp will protect the micro. Also I used a 5.1 Zener diode a resistor at the input of the micro. Attached it is an schematic showing it.
 

Attachments

  • micro input protection.jpg
    54.2 KB · Views: 44
Jpeg link is broken.
BTW, nice find on the TI Launch pad, I like the modular design by stacking boards.
Could easily use second board for relays and third board for inputs (including your unity gain op amp)
Never thought about using a buffer for dc to protect the microprocessor. Should be simple to make with a couple resistors and an op amp
 

Attachments

  • opamp43.gif
    opamp43.gif
    4.3 KB · Views: 152
OK, "Grasshopper" decided to make some modifications.....
I don't have the boards yet so I can't test this. I think I'm progressing somewhat after 9 youtube lessons and your help of course.

I like it! The Zener is also isolated from the Arduino which I've read a zener connected directly to analog input skews the readings.
I attached revision 5 in which I added a temp sensor, standby LED and protect LED

The temp sensor is just a digital port that reads high or low. I simply added this to the shutdown routine using the same flag. I think the way this is setup (just like the analog read shutdown), the amp wont restart until the power button is cycled. I think I have the float_int read wrong. I want to power off if the float_int is less than 29 or greater than 31. The way I read this is the flag is set to 1 if it reads between those two values. I think it should read like this "if (float_int <= 29 || float_int >= 31) flag = 1;" so it will flag the sequence off if the port reads below 29 or above 31.

I created another loop routine for status LED's
I wanted the standby LED off when Arduino boots, after power button is pressed I want the standby light to turn on. Once the last relay energizes (Pin 10), the standby light goes off (Pin10 is HIGH) and the LED integrated in the on/off button will light (this will simply tie to Pin 10).

The protection (fault) LED is set to simply turn on when the flag=1 and the power switch is on (same as the trigger for the power off sequence when the analog port triggers the flag).
 

Attachments

  • LED revision 5.txt
    4.4 KB · Views: 34
Hi,
Normally what I do for reading high voltage it is the used of a unity gain op amp as interface between the high voltage and the micro. If something catastrophic happened the op amp will protect the micro. Also I used a 5.1 Zener diode a resistor at the input of the micro. Attached it is an schematic showing it.

I'm thinking of doing something similar with a cheap i2c AD converter.
 
Hi,
I think your are in your way in the programming.
I forget to mentioned you that you was right about the use of the OR gate in the shutdown If statement. It need an "OR" gate and not an "AND GATE".
It should be " if (float_int <= 29 || float_int >= 31) flag = 1;"
and not " if (float_int <= 29 && float_int >= 31) flag = 1; ". You need to change it in your program.
 
Hi,
I forget to asked you what was the temperature range you are looking for? You can use an LM35 to read temperature and it is a T093 transistor sensor and the range it is −55°C to 150°C .

That would be cool to read the temperature, especially if i install an LCD down the road....
For now, I used a simple thermostat KSD01F TO220 device set at a specific temperature which shorts at high temp. I think it will fall somewhere around 75deg C. I created a simple digital read in the code.

Here's what I found on the LM35, I could implement this is use the similar code on the analog voltage read.
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;

Hi,
Do you understand how delay works in the code? It stops all code from functioning. You are better to write code using millis to do your delay timing. That way other functions can operate at the same time.

I do understand but my amp doesn't use negative grid bias so I'm OK with it (for now). This may happen down the road if I'm not satisfied with my current bias scheme and performance. The circuit was really to monitor current at the cathode to protect the OPT if the bias increases due to a fault or tube failure/aging. This wouldn't happen until the last delay energizes the HV relay. I believe the remaining code would take milli-seconds to catch the fault. I recall you doing something similar in a GM70 amp, care to share the code so I can learn?
 
I've been redesigning Vzaichenko's 21st century protection board and have been using his code up to this point. He's asked that his code not be published in an open forum, but he will usually email a copy to you if you pm him. I'm in the process of learning to write code myself.

I just found the thread, very cool work going on. I might use this in my hot rodded Bedini SS amp.
Are you guys going to put some boards in production anytime soon? I like the fact that your putting all the relays on one board. I did send Vzaichenko a PM earlier, thanks for the info.

I'm on page 28 of the thread now and will chime in later (making sure I dont duplicate anything)
 
Here's an optically isolated overvoltage detector design for direct connecting to a digital input with a pullup resistor. In normal operation it will be pulling the output low. If voltage goes to high, input voltage will be high, signalling trouble. If the high voltage feed is lost, output voltage will also go high signalling trouble. I don't have a supply to test with or I would test in breadboard. As is with the pot set mid travel should activate at 105VDC. Current draw in normal operation should be around 20mA.
 

Attachments

  • DipTrace Schematic - Untitled.pdf
    13.1 KB · Views: 67
Last edited:
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.