Pages: [1]   Go Down
Author Topic: Arduino error in light sensor circuit  (Read 1068 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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,


* Light-sensor-circuit.png (244.04 KB, 2300x1374 - viewed 57 times.)
Logged

Canada
Offline Offline
Sr. Member
****
Karma: 0
Posts: 318
Sometimes teaching, always learning,
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

A proper schematic would be much better.
Logged


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

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,


* Screen Shot 2013-03-20 at 12.45.20 .png (128.8 KB, 889x804 - viewed 38 times.)
Logged

Maine
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
You blocked me on facebook and now youre going to die!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
http://electronicsclub.info/transistorcircuits.htm

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 (223.59 KB, 597x482 - viewed 26 times.)
« Last Edit: March 26, 2013, 10:35:51 am by conradin » Logged

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

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?
Quote
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


* 2013-03-26 21.29.50.jpg (1108.09 KB, 1797x1846 - viewed 34 times.)

* 2013-03-26 21.22.30.jpg (327.87 KB, 878x1447 - viewed 26 times.)
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
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

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).
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.

Maine
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
You blocked me on facebook and now youre going to die!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.



* Screenshot.png (69.35 KB, 944x795 - viewed 29 times.)
Logged

Fort Lauderdale, FL
Offline Offline
Faraday Member
**
Karma: 71
Posts: 6144
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.c

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

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.

Quote from: 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?
Logged

Valencia, Spain
Online Online
Faraday Member
**
Karma: 146
Posts: 5519
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3030
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: