Welcome to Our Community

Some features disabled for guests. Register Today.

Need some help with an ardruino project for a camera mount

Discussion in 'General Talk' started by John Ger, Jul 31, 2024.

  1. John Ger

    John Ger New
    Builder

    Joined:
    Jun 14, 2024
    Messages:
    37
    Likes Received:
    17
    I am working on a project to move a camera above my cnc router and my different lasers. I have a belt drive and guide rod system that I have built and mechanically works soundly but I am having a problem with the adruino programming as I used to program efficiently. But in the past year i have started suffering from a neurological pathway issue that has taken my hearing and am now deaf in one ear and have an issue with memory and extrapolating information at times.

    I am using my old Makeblock Orion as I have a couple laying around.

    I have been programming using blocks instead of line of code and it has helped but I have not been able to get it fully programmed so I am hoping someone else can help.

    What i want is when I press a set of Normally Open contacts it will rune till it hits a set of NO contacts on a limit switch and stops, Then pressing another button and it will run the other direction and stop at the other limit switch. The block programming is requiring my to put in limit switches as the buttons which is fine. I currently have it where it runs one way when i press one button and the other way when i press the other button. I know I have my loops built wrong but I can't seem to remember which way I am supposed to use them. This brain thing is a killer.



    Screenshot 2024-07-31 173215.png
     
  2. Peter Van Der Walt

    Peter Van Der Walt OpenBuilds Team
    Staff Member Moderator Builder Resident Builder

    Joined:
    Mar 1, 2017
    Messages:
    15,509
    Likes Received:
    4,422
    upload_2024-8-1_14-5-56.png

    Their block based IDE misses a couple features that would have been simpler (homing of steppers for example, or absolute position moves, etc)

    Also their 'forever' is a while loop not the arduino standard loop, and Orion start = setup() so might have to do fix up the code it generates to be useful

    But I'd do something like this:

    in the loop() check for the two button presses

    If a key is pressed, go into a while loop that wait for the far ends limit switch to be hit
    Meanwhile it loops 1x step at a time (assuming stepper moves are syncronous, sending one step at a time prevents crashing into switch with a 45000 step move that has 20000 steps remaining?)

    Once switch it hits, it would return out of the loop. and wait for keypress again.

    Going back to plain arduino coding might get you over the bump too - if the tool is too limited, its hard to see the way through, and this one does miss a lot of stuff.

    With a more decent stepper library - you could home the actuator on power up / reset in the setup() routine, and then button press could send stepper an absolute move position instead (after homing it knows where it its zeroed, and any other position from there can be a proper step position, no need to run into limits)
     
    David the swarfer likes this.
  3. John Ger

    John Ger New
    Builder

    Joined:
    Jun 14, 2024
    Messages:
    37
    Likes Received:
    17
    Thanks for the help, I know exactly what you mean it is lacking in abilities with the block system, I saw the same thing in the early days of writing ladder logic in Rockwell SLC 500 software as the blocks became more en-tooled they allowed a lot more parts to be modified as a block, but with them in the beginning you could swap between block and ladder based and go in and make the delicate chages regarding timings and such. But with this brain condition it seems the block is more recognizable but having your screen beside mine helped me see some errors I made. Now I have it extending and retracting and stopping on the limit switches only problem is I have to pull it off of the one it is stopped on to get it to allow input again







    upload_2024-8-1_11-43-28.png
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice