Shop OBEX P1 Docs P2 Docs Learn Events
Help me.. — Parallax Forums

Help me..

xaer8xaer8 Posts: 15
edited 2006-02-07 21:06 in BASIC Stamp
Hi there.. (sorry about my lacks in english language, though i try my best·)

I'm a new basic stampII user, bought it just a month ago. Maybe the i'm the first in my college to use it.·So i'm a bit confused and not sure about the circuit i constructed although after i've referred to lots of manuals and webpages. Actually it is for my final year project on mini swimming robot. I interfaced a direct connection switches which appeared as a joystick to the robot. Then i used an encoder and decoder to reduce my communication line to the basic stamp·as·my robot is using wired communication to control, not wireless. Furthermore,·i used L293 to make·my tamiya motor unit to be able to run on cw and ccw, plus two·standard servos. This robot does not have any sensor with it, because i'm the one who will control it so any sensor is not necessary i think. But·i felt something isn't right about this circuit. So i·would hugely appreciate all of·your kindness to reply me comments or suggestions·on this circuit.·I·register and join·this forum today espcially for this purpose. Please..cry.gif
826 x 637 - 122K

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-05 16:23
    · How's it working so far?·

    · I guess you're going to walk alongside it with it swimming in a pool.· I see that you're going to use a cable between U1 & U2.· Pour quoi?··So, why not just extend the joystick cable instead?· (I suppose you're trying to minimize the number of wires in the cable.)

    · It's possible that, either way, you may couple noise (depending upon the environment) into the circuit.

    · If you converted to digital coding for the joystick directions, then you could use RS-232 between your joystick-controller unit and the robot (and that would be only three wires·in a nice shielded cable.)· This way, you could easily implement a wireless solution (R/C).


    Post Edited (PJ Allen) : 2/5/2006 4:26:25 PM GMT
  • xaer8xaer8 Posts: 15
    edited 2006-02-05 17:07
    Hi there..

    Thanks for the nice and brilliant suggestion. Of course i intended to minimize the number of wires in the cable, but you came up with better solution. Thanks..really. If i implement a wireless solution (R/C), what types of R/C product would you suggest? Can i use the one that already exist in the R/C car toy and modify it to use as my wireless communication? I wish to focus more on finishing this project with the least time consume and the least money could cost. So if possible i would use R/C rather than cable. But if that is not possible, then maybe i will stick with using cable. But i'll consider using your good idea. Any other suggestion or correction on this circuit? Maybe the capacitors and resistors placement and value? I wish to make this project simple but a good one. There aren't many swimming or underwater robot project for me to refer...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Let's try our best together!
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-05 17:36
    xaer8 -

    Since RF doesn't travel well underwater, you will need a surface mounted antenna, so wireless may not be the best route to take.

    Regards,

    Bruce Bates
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-05 18:07
    xaer8,

    · Is it a surface-skimmer (like a boat) or a submarine?· Since you said swimmer, I assumed that it stays on the surface.· I guess there's "upwd" and "down", so...

    · Anyway, if your hand-held (joystick) unit had a BS1, you could convert the directions to a digital code and send that serially/RS-232 with a lightweight cable to the swimmer.· I would send an attention byte followed by a direction byte:
    · 01011010 -- attention ($5A = "Z")
    · 00000000 -- none/no change
    · 00000001 -- down
    · 00000010 -- up
    ··00000100 -- right
    · 00001000 -- left
    · 00010000 -- bwd
    · 00100000 -- fwd
    · So, the swimmer would wait to receive a "Z" and know that the next byte would be a direction byte.
  • xaer8xaer8 Posts: 15
    edited 2006-02-05 18:30
    It's me again, xaer8,

    It's a swimming robot, but could also dive underwater without using any balast or air valve that could enable it to submerge like submarine. Up and down means it swim downward and upward..more like a turtle, not fish. And i prefer not to use another basic stamp at my control unit (joystick). That's why i used direct connections (from 5V, active low) which more like switches(a.k.a. joystick too) to control my robot. Is it possible?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Let's try our best together!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-02-05 20:36
    ·
    xaer8 said...
    But·i felt something isn't right about this circuit
    I saw some weirdness regarding the 7805 circuit and its connection to the STAMP, please see my attachment.
    xaer8 said...
    ...to control my robot. Is it possible?
    Sure.· Why not?

    Post Edited (PJ Allen) : 2/5/2006 8:40:50 PM GMT
    570 x 614 - 60K
  • xaer8xaer8 Posts: 15
    edited 2006-02-05 21:26
    Thanks a lot! [noparse]:)[/noparse] I am very gratefull that you mind to correct that part (LM7805 circuit). Maybe i'm wrong about the placement of resistors and capacitors in the circuit, but isn't the VCC (pin24) of BS2 could be powered by 9V because it has built in 5V regulator( internally regulated to 5V)? What i know is that i have to choose either powering at pin 24 or pin 21 (externally regulated 5V), not both. Is that true? Please let me know.. I cannot take any risk of damaging my first basic stamp... i really appreciate any help on correcting this circuit..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Let's try our best together!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-05 21:29
    You should only use one power source for your BASIC Stamp. I think you should disconnect Vin (pin 24) and use the power from your regulator (connect to Vdd on the BASIC Stamp) -- the onboard regulator shouldn't be used in an application like where you have considerable current requirements on the 5v side. Also, we tend to use the LM2940-5 LDO regulator in our circuits, which is especially useful in battery-powered operations.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • xaer8xaer8 Posts: 15
    edited 2006-02-05 22:09
    Few questions lingered in my mind. Should i apply any resistor value between each of BS2 output pins to both servo and L293? I am using two parallax standard servo and two tamiya motor (DC motor) units controlled by L293. I'm not sure to use any resistor or not. By my reference, some people use resistor, but some didn't. I'm quite confused with this. If i have to, how to determine what value of resistance should i use?

    One more thing, can i apply 9V to VC and 5V to VSS of L293. I'm afraid the output of L293 could not give enough power to both tamiya motor to thrust the robot to swim on and dive underwater. Any suggestion?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Let's try our best together!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-05 22:13
    You don't need the resistors in your circuit as you're only driving into input pins -- there's no danger of them becoming outputs. If you're concerned, 220-ohm resistors inline with Stamp pins to prevent possible component failures from harming your BASIC Stamp.

    I believe you must use the Vc pin on the L293 (you can use 9v) as the 5v input is for the chip's logic. It's been a while since I've used one, so you might want to check the datasheet in case I'm mistaken.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • xaer8xaer8 Posts: 15
    edited 2006-02-05 22:29
    Then, is it right to use 1k ohm resistors between my BS2 and 74138 decoder? I assume the output of each decoder pin is 5V (at high logic). Or should i use 220 ohm instead?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Let's try our best together!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-05 22:50
    That would be fine, but if you're careful with your software design and don't ever make those pins outputs then you can go without the resistors.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • xaer8xaer8 Posts: 15
    edited 2006-02-06 00:22
    Hi.

    Thanks for all the help. After 12 postings full of questions and answers, i come up with the latest circuit (after few adjustments). I've already change LM7805 to LM2940, using 22uF and 0.47uF. I've connect regulated 5V directly to VDD (pin21) of BS2 and left VCC (pin24) unconnected. I also have 2 extra input pins at the jostick and 2 extra pins at my BS2. Now what? I still feel empty and imperfect about whole this circuit. Any suggestion or correction would be most welcome...confused.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Let's try our best together!
    768 x 622 - 109K
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-06 00:25
    Remove the external pull-up resistor from the RST\ line -- there is one on the Stamp module. You only need connect a N.O. push-button between that pin and Vss.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-06 15:12
    Since you have two 'extra' pins, I would tend to put an LED with a 470 ohm resistor in series on one of them.

    I find during debugging that having an LED being blinked by my 'main loop' code to be a very re-assuring thing. And even during running, having that LED winking at me tells me my program continues to work.

    And if you have a logic analyzer of any description, your code can toggle pulses on that LED pin that the logic analyzer can read, to tell you what part of your program you are running.
  • xaer8xaer8 Posts: 15
    edited 2006-02-06 15:51
    Wow.. Why i've never thought of that before? Yes, i'll do that. Thanks! How about the other extra pin? Or should i apply two LED's on both pins? [noparse]:)[/noparse]

    By the way, the other two extra input pin at the hand-held(joystick), how can i make one of them as a 'start' button and one as 'stop' button? What i mean here is as long as i didn't push the 'start' button, any 'up', 'down'.. etc input would be neglected by BS2 and 'Stop' button would stop any activity (neglect any input also) but only accept 'start' button to be pushed again. Is that possible to do in my program? Have any better suggestion?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Let's try our best together!
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-06 17:48
    Oh, and I just noticed. On your 'Controller' side, it looks like you've hard-wired +5 to each of your input pins. You probably want to install a nice 10K SIP or DIP resistor pack resistor between +5 and the pin. Otherwise, your joystick will 'short' out your 5 volt supply, which is not what you want.
  • xaer8xaer8 Posts: 15
    edited 2006-02-06 18:30
    Yes, actually i'm quite lazy to draw those controller circuit (i used student free version of orcad pspice). I guess i know what you trying to tell me. Each of the joysticks button ('up', 'down'..etc) should be normally open (input to 74148 is active low, that's why i connect directly each of them to +5V ) so that when i push any of the joysticks button, the connected pin to the joystick button will send input low to 74148, high to 74138 and then low to BS2. Am i right? Please correct me if i'm wrong. Any suggestion would be most welcome. I still need some improvement here..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Let's try our best together!
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2006-02-06 18:43
    xaer8 said...
    Wow.. Why i've never thought of that before? Yes, i'll do that. Thanks! How about the other extra pin? Or should i apply two LED's on both pins? [noparse]:)[/noparse]

    By the way, the other two extra input pin at the hand-held(joystick), how can i make one of them as a 'start' button and one as 'stop' button? What i mean here is as long as i didn't push the 'start' button, any 'up', 'down'.. etc input would be neglected by BS2 and 'Stop' button would stop any activity (neglect any input also) but only accept 'start' button to be pushed again. Is that possible to do in my program? Have any better suggestion?

    Yes, The start and stop idea would be very easy to impliment. I'm sure there is a more "effecient" way of doing it but you could program it like:
    status var word
    status = 0 'OFF
    main:
    if status = 0 then is_off
    if status = 1 then check_for_off
    rest of code here
    goto main

    is_off:
    (Check to see if Start button is pressed)
    --if so set status = 1
    goto main

    check_for_off:
    (Check to see if Stop button is pressed)
    --If so set status = 0
    --goto main
    --else
    --return


    Just my idea
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-07 21:06
    If you connect an input of the 74138 DIRECTLY (without a resistor) to +5 volts, then connect that pin to one side of a normally open switch, THEN push the button on that switch -- you will SHORT (ie provide a very low resistance path to ground) your +5 to Ground. A definite no-no.

    The result will be something like welding shut the switch, shorting out +5, removing power from the 74138, and probably resetting your project.

    However, if you simply add a 10 Kohm resistor between the 74138 input pin and +5 volts, then when you push the button on that switch the 74138 pin side of the resistor will go to zero volts. The +5 volts is now 'dropped' across that 10 Kohm resistor, which harms nothing, and makes the circuit work the way you want it to. It's called a "pull-up resistor", and is essential for what you are doing.
Sign In or Register to comment.