Arduino error in light sensor circuit

Hello Everyone,
I am designing a circuit with two relays to control an actuator to follow the direction of the sun. This is done by comparing the inputs of two light sensors, through the arduino. The arduino gives an error and resets after the actuator moved for a couple of seconds. Can anyone see/explain the error which occurs in the following circuit design? Does anyone have any tips to improve the circuit design?
Thanks for your response,

It's hard to follow the wires and we don't know what components you have there.

A proper schematic would be much better.

Hello everyone,

I'm still having problems with this circuit design. I tried to organize a proper schematic scheme, in the attachment you will find the outcome. However due to the fact that the relay is a self-made part, I couldn't further organize it.

I hope this makes the system somewhat more clear so maybe someone could give advice about why the system gives an error and resets the arduino after the actuator moved for a couple of seconds. The circuit uses two relays to control an actuator to follow the direction of the sun. This is done by comparing the inputs of two light sensors, through the arduino. The double relay is switched by NPN transistors two control the actuator in two directions. The diodes are added to prevent the current from reverting, but it seems that this happens anyway,

Looking forward to your responses,

My OCD for schematic design is going crazy...
just some pointers.
Input on the left processing center, output on the right.
avoid crossing wires, it makes it confusing.
for your design, fwd / reverse can be achieved with a single output, using an H-bridge.
an additional output could be used for enable / disable.
I am not sure why you have diodes on the base of your transistors? was that to give diode protection?
You will want to diode protect your h-bridge, (or transistors) and your arduino, but, that's not how its done.
here's a basic tutorial on diode protection

the arduino has no diode protection, or at-least my uno doesn't.
using source and ground labels independently instead of making loops to singular source and ground points, can make your schematics much neater.
attached is a drawing of 2 voltage divider references to the aruino. one reference shift to +voltage the other reference shifts to gnd voltage.
by comparing the difference, you can shift your motor accordingly.

by setting your voltage references in physical proximity to each-other, with a divider between the photo-resistors, you can use the casting of shadows, and movement of the sun to let your circuit auto-calibrate.

Screenshot-1.png

Hi, I am working with Thos on this circuit.

Thanks for your pointers. I still couldn't get it any clearer in Fritzing, so took a pen and paper. Basically these are the scheme's we are using. The other diodes (between D-outs and the rest, not in these schemes) were added to try to protect the Arduino from some apparent shocks it got that turned it off when switching of direction occurred due to the LDRs.

So this works fine to drive the motor, stop it, and drive it the other way. It also follows a lamp with some simple code to average between both LDRs. The problem is that after about 20 seconds (depends on how often direction is switched) the Arduino resets and shuts off (not connectable from computer, you have to reconnect it), probably to protect itself from a to high current?

We know we can do this with an H-bridge, but this seemed a cheap and easy solution.

What do you mean by this?

by setting your voltage references in physical proximity to each-other, with a divider between the photo-resistors, you can use the casting of shadows, and movement of the sun to let your circuit auto-calibrate.

Thanks in advance,

Tino

Have you really wired it up as shown on the Fritzing diagram? If so, then you've got a short across the 24V supply, via the Arduino, because both sides of the 24V supply are connected to Arduino ground (one via each Arduino ground pin).

by setting your voltage references in physical proximity to each-other, with a divider between the photo-resistors, you can use the casting of shadows, and movement of the sun to let your circuit auto-calibrate.

see attached, an excerpt from John Iovine's "Robots, Androids and Animatrons" TAB books, pg 133.

Thos:
The arduino gives an error and resets after the actuator moved for a couple of seconds.

Since errors come from code and not the Arduino, what is your code?

dc42:
Have you really wired it up as shown on the Fritzing diagram? If so, then you've got a short across the 24V supply, via the Arduino, because both sides of the 24V supply are connected to Arduino ground (one via each Arduino ground pin).

Nope, please disregard the Fritzing sketch. I made (hopefully) clearer sketches with pen and paper in my last post.

James:
Since errors come from code and not the Arduino, what is your code?

It does not actually give any errors. It just shuts down and resets. Concerning the code, it is running in python through Firmata. But wrong code should not be able to completely shut down a board, should it?

Power supply, big spikes from inductors when you switch them, something like that...

Try running it just with the sensors and not the motors, and see if the sensor logic is functioning correctly.

If it is resetting, it is probably an electrical problem with the motor.