I had to once interface an high voltage circuit to PC, The uC had to communicate thru RS232–Comm port–Serial Port.
Part of the 80C31 8051 SBC
Even though i had isolation at the sensors and actuators to make doubly sure the PC also has been isolated. There are chips that are available for this purpose, The circuit above is built with discrete and passive components except for the opto 4N35. You can use MCT2E and CNY17-3 Optos too. For MCT2E some tweak may be needed as current transfer ratio is 20, for the other two CTR is 100 so above design will work.
The circuit derives power from PC but does not load the PC supply. Any voltage above 5V applied to the PC connectors may lead to damage of motherboard in PC. Old PCs were more vulnerable but PCs today maybe a bit rugged at the Ports. Due to internal current limits and clamping.
The VCC, VDD and Agnd are derived from PC no other power needs to be applied on PC side of opto. On uC side of opto the uC power supply lines +5 and gnd has to be used. There is no copper link between the two sides and depending on opto a 1KV isolation is possible if PCB is well designed. The PCB should show the visual isolation above and components should be laid on separate areas of PCB to prevent creepage.
The LEDs are to indicate the port activity Rx and Tx, they are not required once testing is over. The circuit can be simpler, but this worked for me and it is not tested at very-high buad rates.
The levels of RS232 are not TTL like 0-5 we have both polarities +10 and -10. The circuit has to change that to drive the Opto Leds.
RS232 software. Understanding RS232 Serial Port Communication.
This was done in my early days, i have upgraded it, it ought to work, reduce the number of transistors to make it less sensitive, also a lower value in place of 10M will reduce its sensitivity, use clamping diodes to protect.
More such ideas at – Hobby Hound – Hobby, DIY, Do it Yourself Projects.
BD139 is used to drive the relay as it has good Ic. So you can even use a low ohm relay. If a Relay resistance is high its quality is higher, its power consumption is less and it needs thinner wire SWG-AWG. T2 and T3 form a darlington pair which drives T1. LED1 shows that the water level has reached the top of tank and also that the Relay is energised. D1 a freewheeling diode. R3 10M ensures that the high gain input does not float, yet the low leakage current thru the water is not drawn away by the 10M. R2 limits base current in case water is saline.
The Source file in EAGLE format is here del00006.zip
Measurement of resistor values in circuit configurations are required to be made often, as these might have changed in value due to various tolerance ranges, and hence could be the cause of faults. Likewise the resistance of components used in a circuit, may need to be known. In such cases the measurement of resistance is a must.
The circuit used for measurement of voltage can be modified to measure the value of the unknown resistance. The principle followed is the measurement of voltage drop across the resistance when a constant current flows through it. In the voltage measuring circuit, the unknown resistance is connected to the same input terminals and the switch SR is operated. Then a constant d.c. current from the collector of transistor T I is passed through resistor R16 to the unknown resistance which is grounded. The voltage drop across the unknown resistor is proportional to the value of the resistance as current is maintained constant. This d.c. voltage drop is measured after proper calibration.
For the constant current source a high gain, low leakage, pnp silicon transistor (T1) is required. The range selector switch Rs, which connects the positive voltage to the constant current source enables measurement of resistances in 5 decades i.e. 200 ohms, 2 kilo-ohms, 20 kilo-ohms, 200 kilo-ohms and 2 mega-ohms.
According to the range of resistance being measured the switch Rs also selects the decimal point of the displays in the DPM. A resistor R limits the current to the decimal point of the LED displays. Transistor T I is biased by resistor R17 and variable present VR5. As this preset sets the value of current in transistor T1, it has to be adjusted for calibrating the resistance range. Once the calibration is over, the resistance value is directly read on the DPM.
(This is scanned-ocr from my earlier file, some mistakes corrected – delabs)
Voltage multipliers are used to obtain low current high voltage, from an existing AC Source. Step up transformers can be used, but the insulation problems and care that has to be taken for HV above 1kV, make it difficult. After SMPS technologies and Ferrites were developed, HV for CRTs was generated by blocking oscillators and step up Transformers at High Frequency AC.
Caution Instruction –
Use this with Low voltages like 24V AC for Learning. Do not Use it with High Voltage AC. If you are learning, first work with other circuits using batteries or Low Voltage Mains Adapters.
This circuit uses Diodes and Capacitors, just like the text book circuits.
More Reading –