Shop OBEX P1 Docs P2 Docs Learn Events
OBJ lesson needed! — Parallax Forums

OBJ lesson needed!

I'm working on a robotic arm that has DC motors. I'm using potentiometers to control the position of the arm. To control the 'gripper' I used a slide switch to open and close it and two limit switches to stop the motion.
The problem was that the other motors would not work when the 'gripper' object was called from the parent. I had to call it from a child object and I don't know why that was necessary.
I had to comment it out in the OBJ block of the parent.
179 x 114 - 2K
162 x 105 - 2K

Comments

  • source to look at?

    Mike
  • I've worked with two different small companies (one just this week) that make camera platforms, and both used my simple dual motor controller object. It runs in a Spin cog so you don't have to worry about it being affected by another process. Being Spin, it's very easy to modify if you need.
  • @JonnyMac, The PWM runs up to 35Khz and the duty cycle goes from 0 to 100 in 1% increments. That's pretty amazing. I'm going to experiment with it. Thanks.
    @msrobots, before I share the project code I want to get it to the point where I can demonstrate what it does...without tying up seven cogs. I can do better than that. I'm not concerned with efficiency yet.
  • ...and the duty cycle goes from 0 to 100 in 1% increments.
    It's actually 0.1% increments -- control range is -1000 (full reverse) to +1000 (full forward). The counters do all the heavy lifting.
  • JonnyMac wrote: »
    ...and the duty cycle goes from 0 to 100 in 1% increments.
    It's actually 0.1% increments -- control range is -1000 (full reverse) to +1000 (full forward). The counters do all the heavy lifting.
    I saw that. 0.1% is extraordinary so I wasn't sure. I will examine it closely in the near future. I 'am' curious because I wrote a dual motor driver that runs at 20Khz...and I thought 'that' was good. It ain't even close to your driver!
    I used that driver to differentially steer a wireless robotic arm. My initial thrill did not last long because, among other things, I was limited to 4-bit 'speed' control. I wanted at least 6-bit control...and I wanted to eliminate the three toggle switches on my transmitter.
    What I 'really' want is a larger wireless machine that I can potentially control over the internet. At this point it looks like my vision will require two Propellers or a P2.
    Thanks. I'll add this to my "JonnyMac" folder.
  • With this you get nearly 9 bits of resolution,

    Thoughts that went into the driver:
    -- for motors used in pan/tilt heads I need to have a PWM frequency about ~18kHz (otherwise the motors whine)
    -- at 80MHz the Spin loop update can run at about 37+kHz (I rounded down to 35)
    -- in an 80MHz system, there are 2285 tics in the 35kHz PWM period -- using 1000 units means 2.2+ ticks per unit

    My latest project with this driver -- which I just finished coding on Friday night -- is a remote camera control system. The base unit (with joystick) has four buttons to select which pan/tilt head to control. Coms between the master and the remotes are at 30x/second which is the same as when we're connecting directly. The remotes have an auto shutdown feature so that the pan/tilt head slows down and stops smoothly if the camera operator changes cameras while one is in motion. I just got an email from the client yesterday who told me the system is completely tested and working really well.
  • @JonnyMac, I've learned really major lessons from your contributions to this forum. I'm not going to list them all here but one important thing I learned was 'how' running multiple servos from one cog was possible. Once I understood it I could tweak it. The mobile robotic arm that I built has four servos in the arm and two servos for the pan/tilt. The differential drive controlled two small geared DC motors. I picked apart Duane Degn's Nrf24L01 object for the wireless part.
    I posted it to YouTube and expected a reasonable amount of interest in it but it hasn't gotten many views and there are no comments. I would share the code only if I saw any interest.
    Meanwhile, I want to challenge myself once again.
  • lardom: post the link to your YouTube video.
    I'll watch it!
  • Footnote: I wanted to eliminate the toggle switches and a few of the conditional expressions in the receiver but I lost interest and put this project on a shelf for a year. I will only pick this project up again if enough people could benefit.

Sign In or Register to comment.