Started this project some time ago. Don’t know the programming very well at all, know more industrial program. I have found a code written for this I may use but like the Xod concept. I would like to control a door using a light sensor hooked to a stepper (has more torque) and two prox switches to signal up and down. Basic principle is 1/2hr after dark the door would close and at dawn would open at sunrise. Later on add to it using steps counted. I’ve down loaded several stepper library but just can’t seem to get the patches to work. Be easy on me helping my son with this Ag project for school. Thxs
What have you tried doing? Helping you understand what is wrong with your code would help you grow as a programmer a lot more than just giving you a program.
Start by getting individual parts to work. Have you figured out how to get the motor to run? Turn an LED on/off when it gets light/dark? Turn an LED off when your limit switch is triggered? (An LED is much simpler than a sleeper motor. Get your logic working with an LED, then replace LED with the stepper motor).
Led is no biggie. Here’s my issues. The prox’s are limit up and limit down for door. I haven’t found a patch that allows for the inputs that I need. Industrial programming is a little different. Working off my phone. I will try and send a picture of what I have.
I assume your proximity switches are just on/off switches. They can be read using “digital-read” or “button” nodes. If the true/false values are switched from what you need, you can wire the switch differently, or you can add a “not” node after the button node to invert the values.
Unless your switches have built-in “smarts”, you will probably need to wire them with a bias resistor like other switches. If you wire a switch to a micro-processor like you would a light switch (straight single wire that is make/break depending on switch position), the micro-processor might read false values when the switch is open. Switches can be wired from pin to ground or pin to Vcc. A bias resistor (usually around 10K ohms) should be connected between pin and the opposite voltage (if switch is wired to ground, resistor is wired to Vcc; if switch is wired to Vcc, resistor is wired to ground). This keeps the voltage on the pin from “floating” when the switch is open (the micro-processor able to read the value as either on or off depending on static charges). When the switch is closed, it over-rides the value provided by the resistor.
I’m having an issue with a screen shot of my patch so far. I’m also probably not explaining my issue correctly. I know all about pull up and pull down resistors and debouncing and how to wire the components. I work with this every day on older Allen Brady, Productivity ,Direct 6 plc ladder logic. While these are basic programs for machines these also don’t use the stepper motors. So wiring isn’t an issue it’s the patch itself. The steppers provided for use are few and far and I can’t just replace a led for a stepper motor that requires pwm to run. I’ll try and see if somehow I can screenshot the patch I’ve started. I would be able to move one way but it only allows one switch at a time to be hooked up and also if its forward or reverse that’s a whole nother issue.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.