Shop OBEX P1 Docs P2 Docs Learn Events
ROV Propeller Coding — Parallax Forums

ROV Propeller Coding

kershawroboticskershawrobotics Posts: 8
edited 2011-05-16 11:46 in Propeller 1
Can someone identify a thread or provide assistance on developing code for an Underwater Remote Operated Vehicle? Please understand, I am not a programmer, but may be able to find someone local with experience in other types of coding (Robot C, Labview, etc). This is a pretty simple control system, so I am confident someone has created a similar control program.

Basic Setup
1. USB game pad to laptop.
2. Ethernet hardwire from laptop to onboard network switch.
3. Ethernet hardwire from network switch to "brain".
4. PWM output from "brain" to 4 H-bridge speed controllers.
a. 2 independent vertical thrusters
b. 2 independent horizontal thrusters
5. Digital (off-on) output to 7 air valves.
6. Digital (off-forward-reverse) to one electric motor.
7. Input from pressure, humidity, and temperature sensors to "brain".
8. Data display from "brain" on sensors, valve position, thruster power, etc. to laptop.

Control System
Brain-
9. USB Propeller (Gadget Gangster)
Boards-
10. Ethernet sister board (Gadget Gangster)
11. 3 axis accelerometer (Parallax)
12. 1 axis gyroscope (Parallax)
13. H-bridge speed controllers (RobotShop)
14. Humidity sensor (Parallax)
15. Pressure sensor

The current programmer walked away this weekend and nothing is wired, coded or working. I have found several Objects for USB game pads, ethernet setup, and H-bridge controllers. However, I cannot locate a complete program (I just started looking). What I don't understand is how to fit the pieces of coding together. Which one is first? What is the best sequence? Here is what I assume:
1. Boot or start routine.
2. Establish ethernet communication with laptop.
3. Scan sensors for data.
4. Output sensor data to laptop.
3. Scan USB game pad for input.
4. Output game pad instructions to thrusters, air valves, electric motor, etc.

Thank you in advance for any assistance.

Kershawrobotics

Comments

  • th3jesterth3jester Posts: 81
    edited 2011-04-11 08:11
    I may be of some assistance as this is similar to my senior design, except instead of going under water we are flying. But we are using a wireless router for communication to a computer and a XBox controller for possible user input. Although the UAV is being considered autonomous.

    Since your using the Propeller you are able to perform some of the routines in parallel. For example, you can scan the sensors for data and at the same time output instructions to thrusters, air valves, electric motors, ect. and at the same time you can communicate with the laptop. The Propeller is a multi-core (8 total) micro-controller.

    I don't think you'll find a complete program on the OBEX so you may have to create it yourself. Also since your using mostly Parallax sensors and devices then the objects for those devices can be used without any extra coding.

    What code do you have, if any?
  • kershawroboticskershawrobotics Posts: 8
    edited 2011-04-11 08:34
    No code at this point. The programmer was able to power up the Propeller and establish some type of USB communication. That's it.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-04-11 12:41
    I have no experience with the Prop Ethernet board, but the PWM motor control, the accelerometer, and gyro should all be relatively simple. The humidity and pressure sensors, if they are analog parts, will require an external analog to digital converter, such as the MCP3002 (2 channel) or MCP3008 (8 channel). Both of which are supported by objects available in the Obex.

    Interfacing with the 7 air valves and electric motor will also likely need external electronics, depending on the power draw of those parts. If they're small (like 500ma or less, max) you could use a Darlington Transistor array like this one: http://www.sparkfun.com/products/312 If they're larger than that, using the transistor array to drive relays is relatively easy, or you could use MOSFETs, which may take a little more circuit work. From the software side of things, all of these would be driven in the same manner - Simply set the connected output pin to 1 to turn the device on and 0 to turn it back off, like this:
    DIRA[5] := 1    'Set pin 5 to be an output  (set the DIRection of a pin in bank A)
    OUTA[5] := 1    'Set pin 5 'on' or 'high'   (OUTput value of a pin in bank A)
    

    You typically only need to set the direction of a pin once at the beginning of your program.

    Programming the Propeller isn't very hard, especially if you're mostly using ready made objects from the object exchange, but if no one in your group has any programming experience at all it's going to seem pretty daunting. Take a look at the Propeller tutorials - they demonstrate very simple stuff like working with the input / output pins, calling functions, writing loops, and so on.
  • kershawroboticskershawrobotics Posts: 8
    edited 2011-04-11 13:33
    Jason,

    I received your Spyder program this morning. I will open it tonight when I get home. The air valves should work directly from a digital I/O pin because the current is 0.1 amp. The thrusters will be controlled by a 48 vdc H-bridge from Robot Shop via the PWM signal. I read some of the tutorials today, and yes it will be a steep learning curve for me. I'm hoping a local contact can provide a quick solution. The team needs to demo the vehicle at the end of April.
  • kershawroboticskershawrobotics Posts: 8
    edited 2011-04-11 13:58
    The attachment is a block diagram of the ROV components. Green items are Parallax or Gadget Gangster. Light blue items are either boards or devices. Pink items are Spin Objects I think are needed, which is still a mystery.

    Comments are welcome.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-04-11 16:35
    If I remember right, prop pins have a maximum output current of 40ma (0.04a), so you're likely going to need a transistor between the pins and the air valves.

    Looking at your diagram, the "thrusters" object will likely be a single object controlling 4 pins. A good number of the PWM objects in the Obex will handle multiple outputs. The Fast PWMx8 object will do 8 at a time, so you won't need the "port/starboard/horizontal/vertical" things to be independent objects - they'll just be different "ports" on the same PWM object. The Spyder code I sent you uses the Servo32 object (called ESC in the code) in the same way.
  • kershawroboticskershawrobotics Posts: 8
    edited 2011-04-14 23:02
    Jason,

    The team is reviewing your Quad-Copter files. It should help us get past "Power on". The air valves are actually 12 vdc, so they must be toggled from a separate device. The Darlington Array will solve the problem; thanks. We are working on another path to get the ethernet board working, and hope to make progress this weekend.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-04-15 00:06
    If you have issues, you have my email address, and I check here often too. Happy to help.
  • kershawroboticskershawrobotics Posts: 8
    edited 2011-04-25 08:27
    The team has the Propeller board communicating with a laptop and established a link with the ethernet sister board thanks to this thread and Harrison Pham. The next step is to be able to read input from a Logitech USB Game Pad connected to the laptop. Then they can progress to PWM control, digital control and analog inputs.

    Anyone have ideas on the USB Game Pad communication? Can we assume the game pad will have software that can direct output to ethernet? If so, is an OBJECT needed to handle the game pad input, and which is best?

    Thanks to everyone for the feedback. The team is still a long way from a functioning ROV.
  • JasonDorieJasonDorie Posts: 1,930
    edited 2011-04-25 10:01
    For a game pad, if you're on Windows you're probably stuck using DirectInput. The Propeller can't access peripherals on the PC, so the PC will have to read them, translate the button presses into something that can be sent over Ethernet, and send it to the prop.

    It's conceivable you could find something that'll direct the game pad output to Ethernet for you, but I haven't heard of it. You're unlikey to find a Prop object to deal with it from there. Gamepad objects for the Prop assume the pad is connected directly to the Prop.
  • kershawroboticskershawrobotics Posts: 8
    edited 2011-05-16 11:46
    The team was unable to develop the Propeller control system. There were too many things to accomplish in the short time left. The team disbanded when the semester ended.

    I plan to retain all of the related information and pursue this control system in the coming months. I will need a Propeller expert to assist with the programming. My new deadline is September 2011.

    Thanks to all who responded to my requests. While I am still not a programmer, I have a better understanding of the Propeller capabilities.
Sign In or Register to comment.