Drodzy amatorscy koledzy radiowi, potrzebuję monitora bazującego na PIC 16F876, który pokazuje napięcie, prąd i termostat (włącz wentylator z temperaturą 45 stopni Celsjusza i wyłącz wentylator z temperaturą 35 stopni Celsjusza, aby mógł być używany z liniowym zasilaniem liniowym, które zasila Yaesu FT-857D i Kenwood TM-271a.
Przepraszamy za błąd, więc jest to tłumaczenie Google z portugalskiego na polski.
Very thank you for your prompt reply, I want to build one by my self if you have the code ready better instead we can develop one anyway I want to build there are some of this ready made here in Brazil but this is not in accordance with amateur radio philosophy of the Do It Yourself.
Tell me please why PIC 16F876 is required? In Poland PICs are not a very popular family of microcontrollers. In general, you need MCU with ADC (analog to digital converter), so you will be able to measure analog voltage directly. If measured voltage is higher than ADC reference voltage, you need additional divider – just two resistors. Current can be measured as voltage drop on a known resistor – for details see Ohm’s Law. Temperature regulation is simple – just op-amp and thermistor will do the job.
Please tell us some details about your requirements – maximum measured voltage and current. Do you know any programming language, like C, or C++? Do you have any experience with microcontrollers?
It is supposed to speak in English here, would not it be better on the Edaboard website?
Why PIC16F876 just because I have one piece, but this can be done using the AVEG ATMEGAXX family.
Characteristics, voltage reading from 0V up to 20.0V with a decimal, current from 0A up to 50A with positive rail sense or negative rail resistance sensor, temperature regulation with fan up to 30º C off, at 35º Celsius 50%, 40º 75%, 45 ° and up to 100%, there is no need to adjust, just show on the side of temperature as 40 ° C-75% or 45 ° C-100%, power in Watts from 0 to 1000W (20Vx50A). knowledge in PIC programming, almost anything like a control systems technician, my knowledge is only programming of PLCs in ladder language, but I really appreciate learning at least to understand a PIC or AVR.
Like I said, a code ready for me is really necessary to know to change this to my needs, you have some small explanation after each line of code.
I received a code written for the ATMEGA8 microcontroller used in a KIT called AVT2857 which is very close to what I need. I do not know about copyrights in Poland, so do not post it here, I just need to translate Polish notes into English or Portuguese to understand each line.
I did many applications on PIC microcontrollers, personally I prefer PIC than Atmega.
If I good understand you need just code, I could try to help you with the code.
How I see it now:
- voltage measurement, could be straight as mentioned by resistor divider.
- current measurement, here with 50A probably you need special chip or at least OA to convert current to voltage what could be read by PIC.
- thermostat, here probably you need special chip or at least thermistor.
Maybe on the begging say what you have and what you like to use in the project and we could analyze it.
Hi, thanks for your initiative in helping me. I believe that an I to U converter in the positive rail with the help of an OA like LF356 or another of the same type works because in the positive rail of this
power supply there will always be 25V with respect to 0V of the bridge rectifier due to the regulation being on the negative side. The resistive divider to measure DC voltage up to 20V is correct, with regard to temperature maybe an ASIC like the DS18B20 is the best choice, the thermostat can be a simple one connects a PWM to less than or equal to 30º off, 35ºC 25%, 40 ° C, 50% and above 45 ° C 100%.
If you agree please design your circuit, then we could discuss details and minor changes.
If I could suggest something:
- consider Allegro Micro chips for current sensing like ACS7xx they are ready to measure 50A, I use them and they works well, you do not need to add any external elements, simply connect to ADC. What resolution you expect ?
- measure DC voltage, simply resistor divider will be fine also consider resolution.
- about thermostat, you like to control speed of fan according to the temperature of probably some radiator. Thermistor to measure will be fine, I do not expect that you need high accuracy to measure it. Fan output could be PWM as you suggest with external OA/transistor or if you need only 0 25% 50% and 100% maybe simply I/O output which control voltage regulator for fan supply. I saw TI has ready thermostat chips but we of course could implement it into PIC.
Please let me know your final design.
I'm sorry for the delay to reply your questions. Attached you'll find the original and my version of the schematic and a ready code for PIC16F876 so only need to add temperature reading and thermostat logic. Of course you can make any change as per your needs.
OK, I will follow you scheme and try to make some code.
- Q1 BD139 is it enough for the fan ? maybe better some darlington or mosfet
- 16F876A pin1 MCLR missing reset circuit at least 100n+10k.
- R1/R2 is not 1:10, expected voltage is 13.8V with some deviation (how much?) 1:3 could be enough. I will add some capacitor to ADC input to integrate the result or are you interested in very fast changes ?
- 50A/5V you select 0.1ohm/5W, you will burn it within few seconds 50A*5V=250W, consider much smaller resistance and amplifier. What about 1mOhm which give you 50mV/50A and amplifier 100x. Then you need only 2.5W resistor.
You can use for example Allegro:
https://www.allegromicro.com/en/Products/Current-Sensor-ICs.aspx sensors for current measurement. Up to 200A Hall sensors with integrated signal conditioning circuits are available. Just interface sensor with ADC.
Logic level MOSFETS are good choice for fan controlling. Modern MOSFETs, with low gate capacitance can be directly controlled by MCU. Just use PWM output to control fan speed.
This is my version 2 of the schematic according to your tips. I'm not sure if reset circuit is correct. I choose 10x0,1Ohm-5W resistor because I have this parts and since 50A will be not used very often power dissipation will be not a problem and 10x gain is better to avoid noise so this monitor will be used with a PSU that powers a HF transmitter. Input attenuator now is a 3:1 pot (will be adjusted with my Fuke 87 multimeter) and replaced Q1 with a N-Channel Power MOSFET too.
BTW all parts used in this project I already have this is the reason to used then in the future ATMEGA family will be choose.
I’m not familiar with the PIC family, but in general:
- Many MCUs (e.g. ATMega) has a built-in amplifier, which can be used with ADC. So no external op-amp is required.
- R5 gate resistor has too high resistance. Rather 47R or even less is needed to quickly reload gate capacitance.
- LCD module R/W pin is not necessary, as nothing interesting can be read from LCD
- The way you connected R2 is very dangerous. You can easy short MCU’s input to measured voltage, which will destroy the MCU. Add at least a resistor in series to MCU’s input.