Page 1 of 2

Need Arduino / electrical help

Posted: Mon Jul 27, 2020 12:17 am
by KathyNS
I have an Arduino with a 4-relay shield mounted on it. One of the shield relays turns on 12 volt power to an off-board relay, which in turn switches on 12 volt power to my pier equipment. The software and hardware work well, turning on my mount, filter wheel and focuser, as long as the camera is not plugged in. When the camera starts up, either because the relay got turned on or from being plugged in after the power has already been turned on, the Arduino stops communicating via the USB connection. It will still receive and act upon received commands, but it will not acknowledge them. The COM port becomes locked. The condition can only be rectified by rebooting the Arduino. The USB connection to the computer must be unplugged and reconnected in order to re-establish the COM port.

Is it possible that the surge of current to the camera is causing a spike that scrambles the Arduino's brain? How? And how can I correct it?

Thanks for any ideas.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 12:35 am
by OhNo
:popcorn: Is this a new issue or one going back to when you first stared using your design? I am not savy at all about Arduino. A friend of mine (not a member here) has adapted it to many applications. I will forward a link to this thread and see if he can see what the issue may be.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 12:52 am
by KathyNS
This entire system is new. I have tested it quite a lot with no load, and it all operates as designed. It only started doing this when I hooked it up in the dome and started switching power for the actual devices.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 1:00 am
by OhNo
I though you were using this to run things since spring. Correction noted.So load is the culprit.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 1:03 am
by ARock
Does the camera connect to the computer using USB as well, directly or through a USB hub?
If the Arduino, receives and acts on the commands, it is likely sending acks as well. Maybe the problem is on the computer side? Not sure if you tried this, but can you send the commands to the arduino using the serial monitor in the Arduino IDE instead of the some application? That can let you see what is happening on the arduino port.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 2:05 am
by SkyHiker
Is the Arduino powered by USB or do you use external power? If you use external power, is the ground the same as that of the PC? Just wondering if it could be caused by lack of power from the USB port or incompatible groundings. Any time you connect external devices you should worry about that. This holds for the camera too. If it is powered independently, what ground does it use? One example how some device protects against that is my SSAG, it uses optocouplers to avoid such problems.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 5:44 am
by SkyHiker
Is the Arduino connected to your PC? Is the camera connected to your PC? Is the camera powered by the 2nd relay? Are both relays tied to the same ground? Is the PC tied to that same ground (and the Arduino too if it is powered by your PC)? Does the problem happen when your camera is not plugged into the PC?

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 11:15 am
by KathyNS
Thank you, [mention]SkyHiker[/mention]. That is very helpful. I think you might be on to something re the grounds. I had wondered if I had what audio engineers call a ground loop.

The Arduino is connected to the PC by the USB port. It is powered separately, but of course if the external power is removed, it will draw power from the USB. The camera, of course, also connects to the PC. I haven't tried connecting the camera's power while its USB was unplugged. That's a good test; I will try it.

All the grounds are connected at the moment. The PC would share in the common ground via the USB connections. I think I can fairly easily isolate the ground of the camera's power supply. I will give that a try and see if that improves the situation.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 11:20 am
by KathyNS
ARock wrote: Mon Jul 27, 2020 1:03 am Does the camera connect to the computer using USB as well, directly or through a USB hub?
If the Arduino, receives and acts on the commands, it is likely sending acks as well. Maybe the problem is on the computer side? Not sure if you tried this, but can you send the commands to the arduino using the serial monitor in the Arduino IDE instead of the some application? That can let you see what is happening on the arduino port.
Yes, the Arduino connects to the computer via USB. There is no way to tell if the problem is the Arduino's USB transmit or the computer's USB receive. I can send commands to the Arduino via the serial monitor, and those commands take effect. The serial monitor does not receive responses either.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 12:38 pm
by yobbo89
hey kathy, what is your project about that you're doing exactly ? remote power on and power off for the mount ?, any plans for usb connection,disconect via the same method ? i have a spare audrino so would make use for me , saves me from going out in the cold to reset any droped out device :lol: .

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 1:42 pm
by OzEclipse
yobbo89 wrote: Mon Jul 27, 2020 12:38 pm hey kathy, what is your project about that you're doing exactly ? remote power on and power off for the mount ?, any plans for usb connection,disconect via the same method ? i have a spare audrino so would make use for me , saves me from going out in the cold to reset any droped out device :lol: .
Yobbo,
You live in Brisbane. I grew up there. It never gets cold - wimp! :D

Joe

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 1:47 pm
by OzEclipse
Hi Kathy,

Is it possible that the surge of current to the camera is causing a spike that scrambles the Arduino's brain? How? And how can I correct it?
It sounds like you are on the right track with other advice. For future reference, if you are worried about spikes, placing a small capacitor across dc lines acts as a short to damp out any spikes. Does nothing to the DC power line or dc signals.

Cheers

Joe

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 1:48 pm
by yobbo89
OzEclipse wrote: Mon Jul 27, 2020 1:42 pm
yobbo89 wrote: Mon Jul 27, 2020 12:38 pm hey kathy, what is your project about that you're doing exactly ? remote power on and power off for the mount ?, any plans for usb connection,disconect via the same method ? i have a spare audrino so would make use for me , saves me from going out in the cold to reset any droped out device :lol: .
Yobbo,
You live in Brisbane. I grew up there. It never gets cold - wimp! :D

Joe
haha, i think because it's always humid and hot most of the year,as soon as it hits below 26 deg in " winter" with extra " " ,it becomes kaotic frozen weather ! haha , i'd say climate change difference is what gets me .

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 2:13 pm
by ARock
KathyNS wrote: Mon Jul 27, 2020 11:20 am Yes, the Arduino connects to the computer via USB. There is no way to tell if the problem is the Arduino's USB transmit or the computer's USB receive. I can send commands to the Arduino via the serial monitor, and those commands take effect. The serial monitor does not receive responses either.
Another way to determine what the Arduino is doing is to use the Arduino's LED which is connected to one of the pins. You could add light flashing patterns to the arduino code upon USB recieve/transmit and look for them. The shield might get in the way though.

Which relay shield are you using?

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 3:27 pm
by turboscrew
Hmm, if Arduino executes the commands, it can't be messed up. I wonder if the camera and Arduino use the same USB HUB. In that way the camera's USB signal line could affect the Arduino's USB transmit line without affecting Arduino's receive line. So if you could power the camera without camera USB attached...?

A power surge would either reboot Arduino or crash it. In either case it wouldn't execute the commands.
Also, in digital electronics, ground loops are often wanted, whereas in analogue electronics they are usually avoided.
In digital electronics ground coupled interference is seldom a problem.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 3:34 pm
by Mac
I would put a separate powered USB hub between the PC and Arduino. The Arduino may be sensitive to voltage fluctuations too from the USB devices getting power from the PC. The PC could be throttling available power.

I've dealt with many similar types of conditions with my credit card processing software and terminal devices connected by USB over the years and this was always a good practice.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 3:53 pm
by turboscrew
Also, since the camera is powered through a relay, it's probably not affecting the Arduino's power that much.
To me it sounds like the camera messes the USB. ("The USB connection to the computer must be unplugged and reconnected in order to re-establish the COM port.")

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 4:23 pm
by KathyNS
turboscrew wrote: Mon Jul 27, 2020 3:27 pm Hmm, if Arduino executes the commands, it can't be messed up. I wonder if the camera and Arduino use the same USB HUB. In that way the camera's USB signal line could affect the Arduino's USB transmit line without affecting Arduino's receive line. So if you could power the camera without camera USB attached...?
I will be testing with the camera's USB unplugged as soon as I get a chance.

The Arduino and the camera are on totally different USB hubs, connected to different ports on the computer. There are about as far apart, electrically, as it is possible to be. The hub that the Arduino is on is a powered hub, so I am pretty sure that I am not overloading the computer's USB port.

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 4:39 pm
by Mac
Not sure of the quality of the hub you're using but they vary quite a bit. Don't overlook a wall-brick that's underpowered or not working at full output. They slap them things together very quickly and often with bad tolerance components. Ensure your drivers are up-to-date. USB devices should be able to be plugged in and unplugged without disruption to the connection and host device. That points to flakey drivers and/or bad software.

If you can easily switch them, give it a try.

What is the length of your cable and did you try another?

Re: Need Arduino / electrical help

Posted: Mon Jul 27, 2020 5:07 pm
by turboscrew
KathyNS wrote: Mon Jul 27, 2020 4:23 pm
turboscrew wrote: Mon Jul 27, 2020 3:27 pm Hmm, if Arduino executes the commands, it can't be messed up. I wonder if the camera and Arduino use the same USB HUB. In that way the camera's USB signal line could affect the Arduino's USB transmit line without affecting Arduino's receive line. So if you could power the camera without camera USB attached...?
I will be testing with the camera's USB unplugged as soon as I get a chance.

The Arduino and the camera are on totally different USB hubs, connected to different ports on the computer. There are about as far apart, electrically, as it is possible to be. The hub that the Arduino is on is a powered hub, so I am pretty sure that I am not overloading the computer's USB port.
I'm not worried about overloading, but misbehaving USB device messing up the USB host. Something, like one of the signals shorted or something. The host's logic (state machine) goes bananas. Have you tried a different cable?
For the camera, that is.

Unplugging and replugging an USB cable usually causes reloading (or restarting) of the driver.