PICAXE Ciruit Help needed! I'm trying to figure out why my circiut is not working. Can anyone help?
As part of my school systems engineering course, I have decided to build an automated chook shed door. For the electronic side of this project i'm using a PICAXE microprocessor (PICAXE 08M - to be exact) to control the up and down operation of the door - which is done using a 12 volt linear actuator, all powered by a 12 volt battery (eventually to be rechagred by a solar panel). My theory is to basically read in the light level using an LDR and then based on this level to open the door, or close it. The is designed to work through the use of 3 relays (all with built in diode protection). The first relay is connected to the 12 volt power which supllies power to the other set of relays, and in effect the actuator, when ouput 0 is turned to high (I'm using transistors to do this as seen on the in the shematic). When I want to reverse the the motor I again turn ouput 0 to high, but also ouput 1 to high which switches the the other coupled relays (again using a tranistor) and in effect the polarities of the actuator.I'm also using two microswitchs on the bottom of the vertical sliding door as a safety mechanism, so that when the door is closing and an obstuction occurs (i.e a hand or piece of wood), its programmed to lift the door for about a second before trying to close again. As mentioned before it acts a safety mechanism so that no little fingers can be chopped off, and the actuator it self doesn't overload and blow up (although I'm pretty sure it has inbuilt protection for this anyway).
Ok anyway to the problem, I have wired everything up as to the schematic I have provided, and loaded the program onto the chip (which it does successfully do) - however its not performing as desired. I have placed the same program onto another identical PICAXE system (except it is not obviously connected to all of the stuff mine is) and it works fine. I have also tried reducing the complexity of the program and taking out the LDR readings in the code, and when I do this, it does successfully turn on the relays as desired. For some reason it appears that the LDR is reading a full light level even when I place my finger over it, and because the IF statment in the program relies on a low LDR to operate, the code which turns on the relays never gets to execute. At first it seems that there may have been a problem with the LDR, so I changed it with a new one, but again it continues to read the highest value of 255 (or 1 byte) and therefore the program never executes as desired. I'm not sure why the LDR keeps reading the highest value. CAN ANYONE HELP!
15
answers
|
Answer it!
|
From what you say it sounds like you've narrowed it right down to the LDR circuit. It sounds like the ADC input is shorted to 5V - Have you tested for this with a resistance meter? If it's a short, check and re-check the wiring, especially for solder or wire whiskers between tracks. Also check the value and for dry joints on the resistor to 0V as an open or way too high value would have that effect.
If all is OK, replace the LDR with a variable resistor and see if it works manually adjusting the 'light level'.
Again, thanks for the advice.
Thanks for Best Answer. Glad you got it working.
Chook shed doors appear to be fairly popular thing to apply the PicAxe to. A small controller like that is ideal for that sort of task. And the 08m2 has just been released - Check the PicAxe forum.
Main:
'assumes pin 3 has micro switch fo door closed
'Pin 4 has micro switch for door open
'output 1 high output 2 low opens the door
'output 1 low, 2 high closes the door.
'ADC writes to B1
' runs in Picaxe 08.
B0=1 ' door closed flag
b1=152
check:
if b1<150 then opendoor
if b1>151 then closedoor
sleep 1000 ' low power mode for 16 mins no need to check light often
goto check
opendoor:
if B0=1 then goto check 'check flag
high 1 ' open door
low 2 ' open door
checkstopopen:
if pin4=1 then stopmotor ' door open
goto checkstopopen
stopmotor:
low 1
B0=1
goto check
closedoor:
if B0=0 then goto check 'check flag
low 1
high 2 ' close door
checkstopclose:
if pin3=1 then stopmotorx ' door closed
goto checkstopclose
stopmotorx:
low 2
B0=0
goto check
Thanks.
Steve
What happens if you open circuit the pin ? What happens if you ground the pin ?
Steve
Steve
However your relay connections look rather funny. In general it is usual to use a "standard" H bridge set up if your going to use 2 relays. like this.
example:
B0=0 ' door closed flag of not open must be closed
check:
Check daylight if > set level then open the door else close the door.
open:
B0=1 ; set door open flag
rest of code to open the door.
Close:
B0=0 ' set door closed flag
![]() |



































