Pages: 1 2 3 [4]   Go Down
Author Topic: Freezing problems when power switching.  (Read 3021 times)
0 Members and 1 Guest are viewing this topic.
United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Very interesting! I suggest:

1. Try connecting just the Tx pin, or just the Rx pin, to see whether it is just one of the pins that is causing the problem.

2. When you have established which pin is causing the problem, try connecting it via a series resistor (in the range 1K to 10K) to see whether that fixes it.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Two further questions:

1. Does the problem go away when the laptop is running from battery power and is not connected to anything else except the FTDI cable?

2. I presume the contactor has a mains-voltage coil and you are using a relay to drive the coil. What is the power source for the relay: is it the same 5V supply from the FTDI cable, or is it a separate power supply? If it is a separate power supply, what sort, and does it have a connection to mains ground or not?

I'm wondering if you have a ground loop through mains ground.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Two further questions:

1. Does the problem go away when the laptop is running from battery power and is not connected to anything else except the FTDI cable?

2. I presume the contactor has a mains-voltage coil and you are using a relay to drive the coil. What is the power source for the relay: is it the same 5V supply from the FTDI cable, or is it a separate power supply? If it is a separate power supply, what sort, and does it have a connection to mains ground or not?

I'm wondering if you have a ground loop through mains ground.

Re 1: Problem does not go away when laptop is powered by its battery or mains.

Re 2: Contactor has 220Vac coil. Relay driving the contactor has it's separate power supply (disposable battery). Nothing common to FTDI (separated by Optoisolator).

I shall try connecting Tx/Rx separately (with resistor) and report back tomorrow.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have done the following which for the time being seems to have improved the situation.

1. 15k resistors between TX/RX lines running between Arduino (Atmega 328P Pin 2,3) and FTDI breakout.
2. 5.6 resistor between DTR and Arduino reset (Pin 1 of Atmega 328P)
3. Lowered baud rate to 9600bps from regular 115200bps.
4. Replaced regular USB cable with a one with ferrite beads on both ends.

I did notice doing 1 and 2 improved situation (from 1 on/off cycle before lockup to about 10 on/off cycles), but after step 4 I turned the contactor on/off 100 times continuously without any issue.

I shall continue testing the setup to check stability of the system.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds like your FTDI cable is sensitive to noise. I suspect that noise on the USB cable is being fed into the Rx pin of the atmega328, and the resulting interrupts @ 115200b were overwhelming the cpu.

You didn't say whether you disconnected the DTR signal or not originally to get rid of the problem. Any noise on the DTR signal will cause the atmega to reset.

The more usual way of programming a standalone atmega328 is via ICSP. Then you don't need an FTDI cable, so you are not vulnerable to noise on DTR or RxD.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds like your FTDI cable is sensitive to noise. I suspect that noise on the USB cable is being fed into the Rx pin of the atmega328, and the resulting interrupts @ 115200b were overwhelming the cpu.

You didn't say whether you disconnected the DTR signal or not originally to get rid of the problem. Any noise on the DTR signal will cause the atmega to reset.

The more usual way of programming a standalone atmega328 is via ICSP. Then you don't need an FTDI cable, so you are not vulnerable to noise on DTR or RxD.
.

I always had the DTR cable connected. My primary target is to use the Arduino with Labview, where it DTR is needed to start/restart a VI working with Arduino and Tx/Rx is on constant use. During all of my tests I used Labview running a VI to drive the contactor.

I ran some additional trials. I replaced the FTDI connected between USB port and Aurduino with MAX232 connected between regular RS232 serial port of my PC and Arduino. I was surprised to see that without taking additional measure (resistor/ferrite bead/lower baud rate) Arduino is running smoothly even when I have everything running very close (1.5ft away) from the contactor. So, I agree with you regarding USB sensitivity.

Thanks for all your help!
« Last Edit: September 28, 2013, 01:00:41 pm by mehedyamin » Logged

Pages: 1 2 3 [4]   Go Up
Jump to: