Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Why my usb connection always disconnected?

Status
Not open for further replies.

maniac84

Full Member level 6
Joined
Mar 4, 2012
Messages
337
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,661
Currently doing a project using PIC18F25K50 which I connect its USB interface with Device A. I'm also using this mcu to control a 240VAC relay and this relay will on or off device B. My problem is, everytime I turn on the relay, the USB connection will disconnected.

Is it something to do with noise or spike everytime I on the relay? Do you guys know is this the firmware problem or the hardware problem?
 

post your schematic because of noise as u described.

i think u have used some opto-coupler ic to trigger relay via pic.

and u r created firmware to connect pic and usb using CDC , HID connection or not?
 

post your schematic because of noise as u described.

i think u have used some opto-coupler ic to trigger relay via pic.

and u r created firmware to connect pic and usb using CDC , HID connection or not?

Yes. I'm using the HID connection for the USB.
For the relay part, I've attached a schematic for your view.
relay.png
It is a very much standard relay connection.
But why is it when I turn on the relay from the PIC, the USB will disconnected?
I'm not sure is it because of the noise that cause this. But does when we turn on the relay, there will be spike or noise?
 

I suggest first remove the relay and replaced the LED and check, then you can confirm your self where the problem is existing

As said by nick703 optocoupler is most suitable for this application
 

I suggest first remove the relay and replaced the LED and check, then you can confirm your self where the problem is existing

As said by nick703 optocoupler is most suitable for this application

You mean it's not suitable to use a transistor? I should replace the transistor with opto-coupler?

- - - Updated - - -

Is it something like this?
7nFVG.jpg
 

Yes, I mean isolate the MCU and relay
What happened last
 
Last edited:

I see.
So is it that when we turn on the relay, there will always be spike or noise?
 

Hi,

You do not say exactly what the load to the relay is other than "device B"

Mechanical contacts of relays will always produce electrical noise, so its always a problems.

A usb circuit needs very stable conditions / crystal controlled.

You can add suppressors to the contacts of the relay but the type depends on the load, resistive / inductive.

The contact interference can affect your pic is various ways, though the power lines, input connections/wires or a poorly designed pcb.

A much better way is to use a Solid State Relay, many around to suit the load you are driving , low current ones are relatively cheap.

They will reduce your problems dramatically but it does not mean you have to neglect other part of the circuit design.

https://en.wikipedia.org/wiki/Relay

**broken link removed**
 

My device B is anything that is using 240VAC.

My pic mcu board is powered by the USB power from device A. Is it possible that the power from the USB is not sufficient to turn on the relay as well as providing the power to the pic mcu? Maybe that's why the USB connection disconnected...

- - - Updated - - -

Because I found out that it's not my USB suddenly disconnected. It's my pic mcu off power after I turn the relay on. This caused the USB to be disconnected. After that when my pic mcu power on again, the USB will reconnect again. I know that the relay need more power during turning on time right?
So, that's why I think maybe the power from the USB is not sufficient enough to power my pic mcu plus turn on the relay. What do you guys think?
 

Hi,

A usb port should be able provide 500ma, though if you are using a laptop it might not be able to do that much.

Better to prove things using a 1A 5v wall power pack.

Two points for your test, when you turn on the relay are the contacts connected to any load; that is, as mentioned eariler is it the switching of a mains load across the contacts that is causing the problem ?

You do not give any details of the relay being used, its coil resistance and working voltage / amperage.
Also consider that, usb voltage can be as low as 4.75v, that is then used to power the relay coil , switched by the transistor you use, which causes a voltage drop of 0.7v so you could have as little a 4.0v across the relay which may be too low to energize it properly.
 

Hi maniac84,

Please try adding a suspension capacitor:

**broken link removed**

Regards
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top