Shop OBEX P1 Docs P2 Docs Learn Events
(( Bang & Olufsen )) Motion sensor / DC motor / magnetic sensor / push button p — Parallax Forums

(( Bang & Olufsen )) Motion sensor / DC motor / magnetic sensor / push button p

Toy MakerToy Maker Posts: 8
edited 2006-07-27 09:28 in BASIC Stamp
Greetings everyone, this is my 1st post. (so be gentle)

I purchased a BS2 starter kit a couple years ago for a project I never finished.
Now I have a NEW project I want to use it for, but I need a little guidence.

The project I am working on involves a 5v DC motor, which needs to run forward and backwards.
The motor is activated by a motion sensor, and the motor is stopped by a magnetic sensor on a gear that is connected to the motor.

Here's·a description of the routeen I need.
Wave your hand in front of the motion sensor, and the DC motor activates, opening a door.
A gear·connected to·the motor, has (2)·pieces of magnetic tape, that·the magnetic sensor reads, (1= home)·as the door opens, the sensor sees the·2nd piece of tape,·telling the motor to stop. From this point, there are (2) options, (1) is·to wave your hand again, the motor reverses,·and the door closes, (2) is·to push a small button located behind the 1st door, and·a 2nd door will open, driven·by the same motor, which will stop, when the·1st·magnetic strip is reached on the gear by the sensor again.

In closing mode... it may start from 2nd or 3rd position, depending on what the user has done so far.
If in 3rd position, I want a (full) close sending the motor/gear back to (home position) and a full stop.
I would also like to add a·1 minute·auto-close time delay·routeen in there from both 2nd and 3rd positions.

I'm sure for someone·that has experience with these boards, this should be easy, I however, have no idea where to start.

Any advice, or reference material would be greatly appreciated.

Thanks in advance,

James

Post Edited (Toy Maker) : 7/22/2006 6:17:07 PM GMT

Comments

  • LSBLSB Posts: 175
    edited 2006-07-21 23:43
    James,
    I'm a newbie myself, but assuming you know yer input from yer output here's some points to ponder:
    Motion sensor: probably use IR myself. Parallax sells an emitter and receiver. Emitter outputs like an LED and receiver catches reflected IR of "close enough" object. Not a PIR sensor, but a hand up, say 12" away, will activate.--so will a tv remote from across a big room. How to in "Robotic text" available at Parallax site.
    Hall effect sensors are magnetic swiches. NO or NC available to suit your need. I've never looked, but I bet Parallax sells them too.
    Switch: Yep easily doable, search the robotic text at Parallax and make yourself familiar with pull up and pull down. Most of this will apply to the Hall effect sensor too.
    1 minute timer: BS2 doesn't have a timer, so you can fudge with a 555 timer and count slow pulses, use RCTIME with a big cap (and lotsa loops), or invest a few bucks in a real time clock chip. You guessed it, these are available at Parallax too.
    Reference materials: Start with Parallax Industrial control text, Robot text, and Googling terms you are unfamiliar with. Use 'tutorial' liberally in your searches and start simple. Wire a switch to activate an LED, then try the HFE in place of the switch, then research motors and drivers (a stepper motor might suit your need better) and replace LED with motor and driver circuit.

    "Inch by Inch, it's a cinch-- mile by mile, it's a trial"

    Good luck and keep asking questions!

    Mark
  • T ChapT Chap Posts: 4,223
    edited 2006-07-22 01:51
    All of that is pretty simple once you get a small amount of knowledge. If you got on the right track, you could have that working in a week or less, since it seems you have some mechanical skills and aren't starting from scratch. The only way to respond with a good answer is to understand better what your budget is for the complete system. Different answers to that will provide different answers to how to pull it off. Since you are looking at a Stamp, I'll assume it isn't a toy that will sell for really cheap. That being the case, you'd be best off to start learning about stepper motors. Again, you don't describe the weight of the door. But since you have the opinion that 5v DC is adequate, then the stepper I am describing will work great, again, assuming you have the real estate to park it.

    Check this out, for 11 bucks:

    http://www.allelectronics.com/cgi-bin/item/SMT-86/400/STEPPER_MOTOR,_LIN_4118S_.html

    That is a great example of a fast easy motor to learn how to run the bi polar stepper.

    http://www.allelectronics.com/cgi-bin/item/EDE-1204/285/STEPPER_MOTOR_CONTROLLER,_BI-POLAR_.html

    That IC will get you up and running in minutes. It is a biolar stepper driver that is quick and easy to hook up to a Stamp. Then you are only lacking an hbridge which there are a dozen of out there. Again, budget dictates how fancy you can get. Your best bet is google everything you can read on Hbridges. For low current/voltage appliations like yours, you may be able to easily build your own Hbridfge mosfet driver for very cheap. There is a mosget driver that will simplify the process:

    http://www.irf.com/product-info/datasheets/data/ir2184.pdf

    The IR2184 is very nice (must be able to solder surface chips). Two of those ics and 4 mosfets below:

    (http://www.allelectronics.com/cgi-bin/item/BUZ71A/search/N-CHANNEL_POWER_MOSFET,_T0220_.html

    There are other Hbridge drivers out there too, like this one that is self contained:

    http://cache.national.com/ds/LM/LMD18245.pdf is an examle, decisions would be based on the load on the motor and motor ratings though.

    In my opinion you should first dive into the above, make a decision of what to use, then start bread boarding. Too much current on a stepper means smoke from the mosfets. Once you get the fundamentals down, applying the right motor/driver to your application will be easy.

    As far as waving the hand, there are several methods. IR is one. Depending on how far away you want the hand to be, you could use proximity sensing. See the QT chip on parallax, or goodle Qprox. These are very cool IC's for touch/proximity, that can be adjusted by a cap to set the sensitivity. You could set it to wave the hand 6 inches away for example, it outputs a 1 to the Stamp, the stamp tells the stepper to turn X amount of pulses. Wave again, the Stamp tells the stepper turn the opposit direction(Note on the stepper EDE1204 driver the DIRECTION pin).

    VAR MotionDetect IN1
    VAR Direction OUT2 'open - 1 closed = 0
    VAR Counter Byte 'counter!
    VAR Step OUT3 'connected to EDE1204 Step input
    VAR DoorState BIT ' keeps track of where the door is



    Main:
    If MotionDetect = 1 and DoorState = 0 then OpenDoor
    If MotionDetect = 1 and DoorState = 1 then CloseDoor
    Goto Main


    OpenDoor:
    Direction = 1
    For counter = 1 to 200
    Step = 1
    Pause = 50
    Step = 0
    Pause = 50
    Next
    DoorState = ~DoorState 'toggles state of door

    GOTO MAIN

    CloseDoor:
    Direction = 1
    For counter = 1 to 200
    Step = 1
    Pause = 50
    Step = 0
    Pause = 50
    Next

    DoorState = ~DoorState

    GOTO Main


    Get a fast Stamp, BS2P40 or similar for speed. You could use limit switches to Zero out the counter on power up, or at every move if desired, but the stepper will be quite reliable uless it is obstructed, then you have another set of issues to deal with. Current sensing can tell the door to retract, and re-Zero itself. That should be addressed after you get the first curve under belt.
  • Toy MakerToy Maker Posts: 8
    edited 2006-07-22 04:09
    awsome replies guys !!! that's what I was looking for.

    I guess I should describe my project a little more.
    I purchased a (fried) Bang & Olfusen stereo.
    Here's a link to give you an idea of what it is I'm working with....
    http://www.beoworld.co.uk/beosoundcentury.htm

    http://www.beoworld.co.uk/beosoundcenturya.htm

    http://www.beoworld.co.uk/magicopen.htm

    Bang & Olufsen were nice enough to make this easy for me (I think)
    The door mechnisum, sensors, motor and buttons are all in place. It's a pretty simple modular unit.
    Tomorrow when I get to the office, I will upload a couple pix of the unit, and show you all the parts.
    Everything is already in place and works. It's just going to be a matter of bypassing B&O's circuitry, and
    controling everything with the BS.
    I only want the the glass door to slide open, and the CD tray door to lift, and then both to close.
    I don't care about the rest of the stereo. Everything else has been gutted already.
    This is basicly going to be a (dummy unit) but I do need the doors to open and close.

    Thanks again, and I'll post tomorrow morning !! nite

    Post Edited (Toy Maker) : 7/22/2006 4:53:17 PM GMT
  • Toy MakerToy Maker Posts: 8
    edited 2006-07-22 17:18
    Ok, here are the photos of the parts.

    1st pic is of the mechanism when the doors are closed. Note the small circle with the black tape on the inner gear.

    The red line shows how the door glide will move

    P1010012.JPG

    2nd pix·is of the mechanism once the door is open. Note the hole, it has just passed the 2nd piece of tape.
    The red box is the part that will move in the 2nd step, opening the CD lid

    P1010013.JPG


    Here is the where both door, and lid would be open. Note the circle is again back at "0".
    The gear makes 1 revolution to complete the sequence.
    P1010014.JPG


    Here is a pic of the back of the unit
    P1010015.JPG


    And here is the sensor that covers the small hole, and reads the tape on the gear
    P1010016.JPG
  • T ChapT Chap Posts: 4,223
    edited 2006-07-22 20:19
    You need some fundamental understanding to get your project off the ground, as most people wont attempt to solve it remotely. Here is where I would start if I were you:

    1. Plug in a 5v supply to the motor, check the polarity to the motor and get an understanding of what direction the motor moves based on polarity. Make a mark on the wire that moves the door OPEN when it is +. Then, get read up on DC motor control, there is a ton of stuff on Parallax. Moving a DC motor is very simple and would require only 4 mosfets that you can buy at radio shack for cheap. You will have to build an Hbridge as mentioned before to run any motor back and forth. The Stamp driving an Hbridge directly would be something like:

    VAR DoorOpen out0 'hook this to door open wire
    VAR DoorClose out1 'hook this to door close wire

    VAR StartMotor in2 'for now, wire +5 to a switch, whereas the input is held low with a 10k res
    VAR Direction bit
    'VAR MagSensor in3 'save for later
    VAR Counter byte

    Main:

    If StartMotor = 1 and Direction = 0 then OpenDoor
    If StartMotor = 1 and Direction = 1 then CloseDoor

    OpenDoor:
    for counter = 1 to 100
    DoorOpen = 1
    DoorClose = 0
    Pause 25
    next
    Direction = ~Direction
    Goto Main

    OpenDoor:
    for counter = 1 to 100
    DoorOpen = 0
    DoorClose = 1
    next
    Direction = ~Direction
    Goto Main


    Study this picture:

    http://lims.mech.northwestern.edu/~design/DC/2003/Aukes/Hbridge.gif

    This circuit can be run at 5v without the opto driver. Buy 4 mosfets (pretty much anything using TO220 case), and 4 10 k resistors.

    Get this much going and you are on your way
  • Toy MakerToy Maker Posts: 8
    edited 2006-07-23 02:58
    Well I want to say thank you VERY much for the replies, and giving me a great direction to go in.
    I went and dug out the BS2 and manual today, and I just realized...
    I don't remember ANYTHING I did with this thing before.
    It's actualy "The Board of Education" with a BS2 chip I guess.
    I am going to have to start over and start on page 1 and read page by page, till something comes back to me.

    I'm very mechanicly inclined, I just don't have ANY electronics background aside from building PC's and RC cars.
    I can however wire 110 220 AND 3-phase (without frying anything)
    I guess I need to start reading.

    Well thanks again !! and if I get anywhere, (or stuck) I will post again.
  • T ChapT Chap Posts: 4,223
    edited 2006-07-23 04:15
    Update for code above


    Main:

    If StartMotor = 1 and Direction = 0 then OpenDoor
    If StartMotor = 1 and Direction = 1 then CloseDoor
    DoorOpen = 0 'resets outs to 0 after move
    DoorClose = 0 'resets outs to 0

    That program is rough but should get you in the ball park for making something move, although as you cvan see, it will either not make the full travel, or hit a hard stop as it is not programmed to stop at any particvular place.
  • Toy MakerToy Maker Posts: 8
    edited 2006-07-23 14:54
    I will try to get a little more info om the the sensor to stop the motor. That would just be an input for the BS to see, and tell the motor to stop right?
    I read a little last night in the BS manual, and realize allot of this is over my head still. I understand the book, but there are no real references to any symbols. Vss Vcc and so in. If you don't know anything about electronics, it's like trying to learn Spanich, just by reading it. A little frustratiing, but it look like the finished product should be a simple one. Hopefuly, with your help, I might get something to move, AND stop [noparse]:)[/noparse]
    I might be better off just sending all the parts to someone and paying them to get it right for me.
    The smartest person in the world doesn't know everything, just where to find the answers.

    Anyone have a photo of a finished Hbridge?? Again, not knowing electronics, the schematic is like reading Spanish to me.
    I understand the resistors, and +5v and ground, but I can't picture the finished product.
    The link above http://cache.national.com/ds/LM/LMD18245.pdf might be a good option for me, since I wouldn't have to make the thing.
    I dono guys, kinda starting to feel pretty stupid here [noparse]:)[/noparse]
  • T ChapT Chap Posts: 4,223
    edited 2006-07-23 19:25
    The fundamentals are pretty easy to dig out from google. If you are in the states, there used to be some great starter books by Forrest Mims sold at Radio Shack. A picture of a complete Hbridge wont help if you dont know what to connect. You can easily look at the Hbridge schem I sent, since there is only one component other than the resistor, you should be able to drive to Radio Schack, buy the part, look on the back of the package and see how it is connected. It couldn't be simpler. You wont get anywhere till you start buying parts and trying it out, then getting frustrated for a few days, but ultimately it will come together. Vss is ground, Vdd is +5 in your case. It will be tough to find a photo of a breadboarded Hbridge that you can follow, although it could exist. Wheree Vcc is shown, it would be +5 in your case.

    Det some of these, the connection chart is on the back of the packge:

    http://www.radioshack.com/product/index.jsp?productId=2062618&cp=&origkw=mosfet&kw=mosfet&parentPage=search

    Using NPN mosfets, Gate is typically pin 1 source 2 and drain 3 from L to R looking at the front Why is it called GATE? Give that some thought. Study this photo to get an understanding of how the gate works

    http://www.fairchildsemi.com/ds/BU/BUZ11.pdf

    A mosfet is nothing more than a switch. Think of it as a relay with an input to turn the "contacts" on, and two leads that are going to make contact when you put a voltage at the gate input. If you want to switch +5 on through the switch, put a real switch connected to 5+ to the Gate, put 5+ at the Source and meter the Drain or put an LED with a 470 resistor off the drain to ground. (- or Flat side of the LED to GND). Once you get the concept of how the mosfet works, stare at the hbridge schmatic for about 3 hours till it hits you. A motor needs + and - to run, but it needs that voltage to reverse to go the other way, that requires switching, and that is all that an hbridge is, a polarity reversing switch. Ok well it is providing current as well, as the stamp wont drive motors.


    if you are really strapped for time then buy this

    http://www.hobbyengineering.com/H1918.html
  • Toy MakerToy Maker Posts: 8
    edited 2006-07-26 00:43
    Me again....
    I thought I would post this just in case any other "Electronically Challenged" people run over this thread.

    ·Dee%20Dee%20Dee1.jpg

    This page seems to be a little more my speed.
    I DON'T buy Playboy for the articles... I like the Pictures !!!

    http://www.robotroom.com/HBridge.html

    I will post again once I get a minute to go get all the parts and get this sucker running.
    If I can figure it out (knowing as little as I do about electronics) anyone can do it.
  • Toy MakerToy Maker Posts: 8
    edited 2006-07-26 01:22
    One more pic....
    This is the board that the power supply runs to. It's also the board the 5v motor is connected to.
    The motor connects to P17 at the top left.
    The 2 gray PWR blocks at the bottom left, and the white strip to the left of that, are the inputs from the power supply.
    I am guessing the H-bridge is already in here... I just need to figure our what connections·control it?

    BnO%20Power%20board.JPG
  • Toy MakerToy Maker Posts: 8
    edited 2006-07-26 21:28
    Will this work ??? I don't mind spending the $30, and they will have them in stock on Friday.

    http://www.parallax.com/detail.asp?product_id=27961


    http://www.parallax.com/dl/docs/prod/motors/MotorMindbMan.pdf

    27961.jpg
    ·
  • T ChapT Chap Posts: 4,223
    edited 2006-07-27 09:28
    my guess is that the parallax driver would be easy to get up and running. ic22 is most likely the driver on your board. trying to reverse engineer b and o stuff would be harder than starting over with parallax parts. i would just order it, dive in and it will not be too tough since they have a lot of documentation. the dallas stuff is fine too, you could mayber get it off digikey.com for cheap. try them both maybe.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    something smells like it's on fire
Sign In or Register to comment.