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!