(( Bang & Olufsen )) Motion sensor / DC motor / magnetic sensor / push button p
Toy Maker
Posts: 8
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
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
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
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.
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
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
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
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.
Here is a pic of the back of the unit
And here is the sensor that covers the small hole, and reads the tape on the gear
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
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.
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.
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]
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
I thought I would post this just in case any other "Electronically Challenged" people run over this thread.
·
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.
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?
http://www.parallax.com/detail.asp?product_id=27961
http://www.parallax.com/dl/docs/prod/motors/MotorMindbMan.pdf
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
something smells like it's on fire