Shop OBEX P1 Docs P2 Docs Learn Events
Eddie board as stand alone controller. — Parallax Forums

Eddie board as stand alone controller.

TimbotronicTimbotronic Posts: 7
edited 2014-06-04 16:45 in Robotics
Hello, I'm using the Eddie board without the kinect, a laptop, or RDS4. I do have the base, motors, encoders, ping, batteries and IR sensors. What I'd like to do is make a little autonomous robot. I have the ping sensors controlling an LED when an object is within specified distance. The problem that I'm having is controlling the on-board H-bridges and knowing how to use the encoders. Since I'm not using RDS4, I can't enter the firmware commands serially. So, my question is: How might I control the on-board H-bridges with the setup I have? And, do I need to use the encoders?

I've only just completed the spin tutorials so spin is new to me. I've been told that I might be able to alter the firmware so that instead of the board communicating serially via some monitor, the board could communicate internally with the sensors. Perhaps someone more experienced in spin has made these alterations?

pingLEDcode.png
Here is the code to light an LED when an object is within 10 inches. At the bottom, instead of lighting an LED, I'd like to control the motors.
Any thoughts?
-Tim
791 x 624 - 66K

Comments

  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-06-02 19:34
    You should use Code Brackets to post your code. If it does not come up when first posting, click Go Advanced, highlight your code and select the # sign.

    Try changing the pins on OUTA to the pins that your motors are on. Then adjust your code as needed from there. When starting out a lot of times it is just trial and error to see what works and what does not.
  • TimbotronicTimbotronic Posts: 7
    edited 2014-06-02 23:05
    NWCCTV-Thanks for the tip.

    The Eddie board has on-board H-bridges, so it's these that I need to control via PWM (and something else that I'm not doing). I reviewed the data sheet for the H-bridges and the take a PWM signal from 0 to 20 kHz so I created very simple code that sends a 15 kHz signal to the appropriate pin(23), but nothing happened. I guess I'm just not sure how to properly use these H-bridges(VNH2SP30 by pololu).
    Obj
       ping : "Ping"
    Con
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    Var
      long range
      long Stack[36]
      long Stack1[36]
      long Stack2[36]
      long Stack3[36]
      long Stack4[36]
      long Stack5[36]
    Pub Cogs
       cognew(Pingmethod(1), @Stack1)
         
       cognew(Pingmethod(2), @Stack2)
         
       Pingmethod(0)
    
    
    Pub  Pingmethod(ping_pin)
      repeat
        range := ping.Inches(ping_pin)
        WaitCnt(ClkFreq / 4 + Cnt)
        if range < 10
          repeat
          dira[23]~~
          !outa[23]
          waitcnt (79_985_000 + cnt)
         outa[23]~
    


    The 79_985_000 pause above is my attempt at creating a 15 kHz signal(80_000_000 -79_985_000 = 15_000).

    The schematic and the data sheet are pretty much the only thing that I have to go off of.
    H-bridgeschematic.png

    I'm not sure what to do with the INA and the INB. I tried setting them both high to no avail.

    Maybe it would be easier to just not use the on board H-bridges and just use external ones?

    Tim
    791 x 665 - 74K
  • PublisonPublison Posts: 12,366
    edited 2014-06-03 08:52
    Looking at the schematic and a quick scan of the code, it looks like INA and INB are Forward and Reverse.

    Maybe try INA=0 and INB=1 ?
  • TimbotronicTimbotronic Posts: 7
    edited 2014-06-04 16:45
    I finally got the motors to turn by setting INA = 0 and INB = 1(or opposite). Now I just need to figure out how to control the speed and the direction.

    Thanks for the help
    Tim
Sign In or Register to comment.