Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

sometimes unexpected behiviour at power up

Status
Not open for further replies.

skmdmasud

Member
Hi..
My circuit around 10% of the time hangs when powering up by connecting the transformer at 220ac wall outlet or when the wall plug is loose.

The sequence of my uC start up:
1. Shows greeting message
2. Shows time from RTC
3. Turns on a relay
4. LOOP (show time and wait for button press)

As my uC starts some time i see the greetings message in the LCD display and some times there is no display but the relay starts operating and some times there is nothing.

90% of the time it works fine.

uc.JPGRTC.JPGoverall.jpg

How to solve this behavior. Once it reaches step 4 it keeps on functioning as expected.
 
Last edited:
The microcontroller is likely having issues with voltage dips and spikes caused by the relay and solenoids being on the 6V supply that it runs from. Simply use an additional 78L05 to provide 5V solely to the microcontroller and RTC.

I don't know what you're trying to draw, but your schematic is incorrect, esp. in regards to the transistors being connected between +6V and GND. The diodes are also in the wrong place. You should put resistors in series with the NPN bases as well.
 
Hi..
My circuit around 10% of the time hangs when powering up by connecting the transformer at 220ac wall outlet or when the wall plug is loose.

Certainly transients created by the loads can be a factor once the MCU is running, but the underlined part of your post suggests a more serious supply problem.

Your MCU will not work without a steady supply. If jiggling the cord causes interruptions in that supply, then the wall connection needs to be addressed.

When you plug into the wall supply to turn it on, you probably have a situation of severe "switch bounce." That is, contact may be made and broken several times before a stable contact is established.

One thing to consider is a better switch between the wall supply and your MCU power supply. Another thing is to insert a delay in your program. For example, you can check for the oscillator to be stable and not move on in the program until it is stable for a predetermined period.

John
 
The microcontroller is likely having issues with voltage dips and spikes caused by the relay and solenoids being on the 6V supply that it runs from. Simply use an additional 78L05 to provide 5V solely to the microcontroller and RTC.

I don't know what you're trying to draw, but your schematic is incorrect, esp. in regards to the transistors being connected between +6V and GND. The diodes are also in the wrong place. You should put resistors in series with the NPN bases as well.

Hi dougy82
the diagram of NPN is wrong my mistake but in the circuit i connected it properly. I made the semantic today morning just to show in the forum, i made the circuit 2 months back and still adding codes (new features) to the uC everyday.

I dont think its from the relay cuz some times the relay is never fired, after showing the welcome screen there is a 2 sec delay before it fires the relay.:confused::confused:
 
Certainly transients created by the loads can be a factor once the MCU is running, but the underlined part of your post suggests a more serious supply problem.

Your MCU will not work without a steady supply. If jiggling the cord causes interruptions in that supply, then the wall connection needs to be addressed.

When you plug into the wall supply to turn it on, you probably have a situation of severe "switch bounce." That is, contact may be made and broken several times before a stable contact is established.

One thing to consider is a better switch between the wall supply and your MCU power supply. Another thing is to insert a delay in your program. For example, you can check for the oscillator to be stable and not move on in the program until it is stable for a predetermined period.

John

Hi John
you are correct it is case of switch bounce. Can you explain more on

" For example, you can check for the oscillator to be stable and not move on in the program until it is stable for a predetermined period."
 
Not sure which chip you are using. Most of Microchip's devices have provision for checking when the oscillator is stable. Here is how I did it with the 16F1519:

Code:
START						;							|B0
	BANKSEL	OSCSTAT			;							|B1
	BTFSS	OSCSTAT,HFIOFR		;HF internal oscilator ready?	|B1
	GoTo		$-1				;keep checking				|B1

You can then add a delay, if need be.

John
 
Not sure which chip you are using. Most of Microchip's devices have provision for checking when the oscillator is stable. Here is how I did it with the 16F1519:

Code:
START						;							|B0
	BANKSEL	OSCSTAT			;							|B1
	BTFSS	OSCSTAT,HFIOFR		;HF internal oscilator ready?	|B1
	GoTo		$-1				;keep checking				|B1

You can then add a delay, if need be.

John

OPPS... dont understand assembly..i am using Atmel AVR.
 
Atmels have in fuse settings how long it waits after power up, so try using the highest setting. Also using the brownout detector if it has it is not a bad idea.
 
One good technique is to just put a 250mS delay in your code before the code does anything else. That allows the PSU voltages time to stabilise etc before the micro tries to do stuff.

Also when the micro boots up its pins are in high impedance state, so you should have pull-down resistors etc on the output driver pins so any relays or loads are held OFF whenever the pins are in a high impedance state.

Then once the 250mS startup delay has finished, you set the pins to the OFF state for your loads, and finally set them as outputs.
 
One good technique is to just put a 250mS delay in your code before the code does anything else. That allows the PSU voltages time to stabilise etc before the micro tries to do stuff.

Also when the micro boots up its pins are in high impedance state, so you should have pull-down resistors etc on the output driver pins so any relays or loads are held OFF whenever the pins are in a high impedance state.

Then once the 250mS startup delay has finished, you set the pins to the OFF state for your loads, and finally set them as outputs.

Hi Mr. RB,
I have a 2 sec delay in the start of my code. Yesterday i did some more observation and found out that it could be due to sparks from relay. Since reading the RTC and turning on relay are back to back and the uC running at 1Mhz is very fast and could possible in real time they both virtually may be happening at the same time.

I then added a 5V regulator after my 6V regulator and connected the uC with the 5V regulator and it seems to have improved a lot. Although my 5V regulator output is at 4.3V due to VDrop and my lcd refresh rate has become even slow and dim but i dont mind.
 
I then added a 5V regulator after my 6V regulator and connected the uC with the 5V regulator and it seems to have improved a lot. Although my 5V regulator output is at 4.3V due to VDrop and my lcd refresh rate has become even slow and dim but i dont mind.
The 6V rail should be considered to be a noisy rail. The 5V rail should be separate, i.e. the input of the 5V regulator should be connected to the input-voltage bulk capacitors.
 
The 6V rail should be considered to be a noisy rail. The 5V rail should be separate, i.e. the input of the 5V regulator should be connected to the input-voltage bulk capacitors.

Hi dougy82,
you are correct the 6V rail is considered noisy. I took the short cut approach:rolleyes:. I will feed the 5v regulator from the bulk cap.:) this will also solve my 1.7v drop.
 
I wouldn´t call that shortcut. I don´t know which exact regulator you used, but clearly trying to get regulation on a 1V drop is wrong, most regulators need at least 1.5V difference between intput and output to maintain regulation, and preferably much more.
 
I wouldn´t call that shortcut. I don´t know which exact regulator you used, but clearly trying to get regulation on a 1V drop is wrong, most regulators need at least 1.5V difference between intput and output to maintain regulation, and preferably much more.

well anyway i will redo the power unit. :).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top