Designing a simple alarm circuit using microcontroller

Thread Starter

nestbulala

Joined Dec 12, 2015
111
Hello eetech00, Sorry, I did not notice you removed the internal pull ups on the code that is why it did not work. But now it is working as we planned. The only thing that does not work is the reset. But it will reset on power off so it does not matter. I will make the PCB and I will upload the finish project as soon as I am done. Again, a very BIG BIG THANK YOU for all the effort and the time you have given for my project. And for the forum guys thank you very much for giving us guidelines and information on how to solve our predicaments.
 

eetech00

Joined Jun 8, 2013
4,705
Hi

Hmmm....the reset should have worked.....and yes....don't enable the internal pull ups since we are using external pull ups.

Anyhow....glad you got it working!:)
 

eetech00

Joined Jun 8, 2013
4,705
Hi

Here is source code v5 modified for PIC12F508 uC.
Problems were mainly associated with register name differences between 508 and 629 uC's.

eT
 

Attachments

Thread Starter

nestbulala

Joined Dec 12, 2015
111
Hello eetech00, I have tested your code and it worked like 629. Again Thank You very much for your help. I will have to do the PCB and test it with the other components in the circuit and I will keep you posted. I really appreciate what you're doing in helping guys like me. In a way to reciprocate, I will post the completed project to be able to inform and educate other guys out there.
 

eetech00

Joined Jun 8, 2013
4,705
Hello eetech00, I have tested your code and it worked like 629. Again Thank You very much for your help. I will have to do the PCB and test it with the other components in the circuit and I will keep you posted. I really appreciate what you're doing in helping guys like me. In a way to reciprocate, I will post the completed project to be able to inform and educate other guys out there.
Your welcome:)

Yes, post your project....Its always good to share the knowledge..
 

Thread Starter

nestbulala

Joined Dec 12, 2015
111
Hi eetech00,
I have tested your design with minor modifications and I am facing problems on the output voltage of Q1. When the Alarm switch is triggered and pulsing the LED, it drops the voltage from 11.96 to 4.8 and the current from 8.4 to 10.8 ma. Since the voltage to U1 (78L05) drops below the required voltage, the LED would not light. But before I added the pull up resistors, the LED lights and the voltage output of U1 is 4.96 Volts. I am suspecting the (Q1) BDX53C but before I will replace it I need your advise and other solutions you might share. Alarm Signalling Circuit using PIC12F508 Microcontroller.png
 

John P

Joined Oct 14, 2008
2,061
Ask Dr Ohm: What is the voltage drop through R1 at a 10mA current?

Edited to ask innocently, why is R1 a 5W resistor? If it dropped the full 48V, it would still be dissipating less than 0.5W.
 
Last edited:

Thread Starter

nestbulala

Joined Dec 12, 2015
111
JohnP, the voltage drop through R1 at 10 ma is 61 - 14.5 = 46.5 Volts. At 8 ma is 61 - 5.5 = 55.5 Volts. I have tried to use a lower wattage resistor but it seems hotter than usual.
 

bertus

Joined Apr 5, 2008
22,925
Hello,

I am not an LTSpice user, but when I take the voltages and do the calculations by hand I get:
(60.7-14.88)/5600=8.18 mA
(60.7-5.40)/5600=9.88 mA
Those are quite different than the values given in the simulation.
Perhaps someone else can give you a clue about what is happening.

Bertus
 

eetech00

Joined Jun 8, 2013
4,705
Hi eetech00,
I have tested your design with minor modifications and I am facing problems on the output voltage of Q1. When the Alarm switch is triggered and pulsing the LED, it drops the voltage from 11.96 to 4.8 and the current from 8.4 to 10.8 ma. Since the voltage to U1 (78L05) drops below the required voltage, the LED would not light. But before I added the pull up resistors, the LED lights and the voltage output of U1 is 4.96 Volts. I am suspecting the (Q1) BDX53C but before I will replace it I need your advise and other solutions you might share.
Hi

The dropping resistor to the input of the transistor regulator will limit current and cause the voltage input to the IC regulator to vary widely. It also obsoletes the isolation boundry between the 48v circuit and the 12 volt circuit. Even if configured correctly (without the dropping resistor) it will run hot and will need a large heat sink.

Just the LED's (with a 120 ohm series resistor) will draw about 70ma.:eek: To limit the current thru the two LEDs to 10ma, you need to replace the 120 ohm resistor with an 820 ohm resistor, or even better, replace it with a 1k resistor for each LED.

The last schematic I posted in post #43 showed a 5v isolated buck power supply. That supply will regulate properly, maintain isolation and run cooler.

eT
 

Thread Starter

nestbulala

Joined Dec 12, 2015
111
Hello,

I am not an LTSpice user, but when I take the voltages and do the calculations by hand I get:
(60.7-14.88)/5600=8.18 mA
(60.7-5.40)/5600=9.88 mA
Those are quite different than the values given in the simulation.
Perhaps someone else can give you a clue about what is happening.

Bertus
Hi Bertus, You are correct by calculation but the voltages were gathered through a digital multimeter on an actual loading condition. You must also consider the test lead resistance, the tolerance of the resistor and the accuracy of the meter which is near to the theoretical calculation.

Hi

The dropping resistor to the input of the transistor regulator will limit current and cause the voltage input to the IC regulator to vary widely. It also obsoletes the isolation boundry between the 48v circuit and the 12 volt circuit. Even if configured correctly (without the dropping resistor) it will run hot and will need a large heat sink.

Just the LED's (with a 120 ohm series resistor) will draw about 70ma.:eek: To limit the current thru the two LEDs to 10ma, you need to replace the 120 ohm resistor with an 820 ohm resistor, or even better, replace it with a 1k resistor for each LED.

The last schematic I posted in post #43 showed a 5v isolated buck power supply. That supply will regulate properly, maintain isolation and run cooler.

eT
eetech00, I have used that same configuration on my previous project on Circuits and Projects on the same forum and it was functioning fine. That is why I need to change the transistor because that was the only difference. At the moment, I don't have the 5V isolated buck power supply so I cannot simulate it. I will replace that series resistor 120 ohm and see what's the difference.
 

Thread Starter

nestbulala

Joined Dec 12, 2015
111
Hi Guys,
This is the final drawing and the voltages shown on the regulator is stable even when flashing. I will publish the proto-type when it is done. Thanks for your help especially eetech00 and I really appreciate it.
Alarm Signalling Circuit using PIC12F508 Microcontroller3.png
 

Thread Starter

nestbulala

Joined Dec 12, 2015
111
Hello Guys,

I am facing difficulties on making the Opto Coupler works. I have used the ISD74 a dual opto coupler which is having a forward current of 50 ma and 1.2 volts operating voltage. I have tried to satisfy the requirements but still the opto coupler does not work. Tested the the components on the forward and reverse voltages with an ohmmeter on both sides showing fine. Tried to replaced it a new one but still the problem exist. Can anybody spot what is problem? I have attached a spice simulation for your reference. Thanks in advance.
OptoCoupler Simulation1K.png
 

Thread Starter

nestbulala

Joined Dec 12, 2015
111
Hi

What are you trying to accomplish?
This is part of the circuit for the Alarm Module using Microcontroller in which we want to isolate the voltage signals to the Microcontroller using Opto Couplers. I have tried to simulate it to determine the correct series resistance to get the current and voltage that will make it work. For a certain current that will pass on to the LED, the Photo Transistor should trigger.
 
Top