Controlling a CD Player
rev
Posts: 27
Hi-
I have a bs2sx and I would like to have it turn on a dvd player and activate the play function, then periodically stop and restart it. any ideas? thank you
I have a bs2sx and I would like to have it turn on a dvd player and activate the play function, then periodically stop and restart it. any ideas? thank you
Comments
It might be possible for the Stamp to work like a remote control.· It depends on the DVD manufacturer and the coding scheme they use.· Look at Parallax's "IR Remote for the BoeBot" tutorial for a discussion of the issues and sample code for, I think, Sony's IR protocol.
·
you could wire the µC to the remote control Chip but there may be some issues with source sink and also if its a matrix style it could get complicated to wire add code .
I ran in to the same isolation and source sink issue with my hacked Cam I used for TL cam so I used reed relays (with a 2N3904 driver)
to emulate the power and shutter buttons
Peter KG6LSE
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Carpe Ducktum" "seize the tape!!"
peterthethinker.com/tesla/Venom/Venom.html
Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway. —Tanenbaum, Andrew S.
LOL
By wiring a diode across the coil you are preventing a voltage spike from getting back to the stamp as illustrated in the following image?:
I have used the 2N3904 driver to give my stamp some more mojo in the past, but it would be nice to find another simpler way. thanks for the pointers guys, its been a while since I've delved into this.
There are 5V relays, but they verge on 20mA each.· If you have several relays then you could use an IC like the ULN2803, but, in my view,·that's a waste for one.
www.radioshack.com/product/index.jsp?productId=2062478
Coto makes an equivalent one that has a 20mA coil current. You need something like a 1N914 diode (also available from RadioShack) wired as shown in your diagram, but without the switching transistor. If you're only activating one or two relays at a time as you would be in controlling a CD player, you'll be fine.
Is a 1N914 switching diode interchangeable with a 1N4148 in this instance?
For now, I'll only need to trigger 1 relay at a time. Shortly, I'll need to trigger 5 virtually simultaneous pins for 5 dvd players, would a ULN2803 do the job triggering 5 simultaneous reed relays? or should individual transistors be used, 2N3904 or 2N3906? or neither? ... perhaps I would control a universal remote that triggers all 5 DVD players, though I'd be a bit concerned about the longevity / reliability, and this circuit needs to last.
Also, what are the potential risks of frying the DVD player? ie. how would one go about ensuring that doesnt happen?
Since the Stamps have only 16 I/O pins (except for the BS2p40), you may want some kind of I/O expander to handle more relays. If you have 5 DVD players, each with 4 or 5 buttons you want to control, you will need more I/O. The TI TPIC6595 combines a 74HC595-like serial shift register with a parallel latch along with 8 MOSFET switching transistors plus the protective diode suitable for controlling relays. You can cascade these like the 74HC595 for multiples of 8. All of the coding examples for the 74HC595 will work with the TPIC6595. Look in the StampWorks Manual and in the Nuts and Volts Columns.
The whole idea of using a relay is to have something that works just like the switches in the DVD player and is completely isolated from the DVD player's electronics. If you connect the relay contacts carefully across each of the pushbutton switches involved, the DVD player can continue to be used normally, but can also be controlled remotely by the microcontroller.
What we call Heath Robinson and you guys call Rube Goldberg, overcomplicating a solution when a simpler one is available, now making the player drive itself to you to press the buttons when you want sounds a good idea.
what I am doing is creating 5 simultaneous 'loops' on 5 DVD players. If one simultaneously plays 2 or more tracks of the same length on two separate DVD (or cd, cassette, etc ) players, they inevitably go out of sync afte a while. This is unacceptable in this particular instance, hence the need for the Stamp. It was proposed that the syncing be done with 5 mac minis, which, while entirely feasible, is also much more expensive.
So, the goal is ultimately to control 5 DVD players, using the basic stamp as a common time reference to which all of the DVD players are periodically synced, and thus keep all of them essentially in time.
The idea was never to control the basic stamp with IR, but rather to control a universal IR remote with the basic stamp, and have that remote simultaneously restart the players at the end of their said loops, or some interval thereof.
This is the automation component for an art project, so it's ultimate practicality IS certainly debateable, I suppose, however the collector who bought the piece finds the DVD syncing to be a real problem.
also, and my apologies in advance if this is seen as a silly question, what are the basic stamps capabilities as far as time keeping goes? Do I need something like the DS1302 for this project? For the fist project i will be restarting a dvd player every 8 min, 31 seconds, for the second project i will be triggering 5 dvd players every 4 hours or so. thanks in advance!
2) The Stamp is at best "ok" at timekeeping. For the long time periods you're talking about, I'd use an external real time clock. You don't need to set the clock and you don't need a battery backup if you reinitialize the clock when the Stamp is reset. For something as simple as this project, you could get by without a real time clock. The Stamp may "drift" a little, but the various DVD players will stay in sync with each other, at least to within a couple of seconds. You really need a real time clock if you want everything to stay in sync with the time of day though.
I am going to house the whole electronic component in this DVD player, the only thing lacking from the attached picture is a 120V receptacle for the optoisolator output. I would also like to have a button and a 2 way switch easily accessible on the exterior of the DVD player. With the button I need to trigger and terminate the process, which I can achieve simply by interrupting the power to the stamp via the regulated power supply's + line. Via the 2 way switch I would like to enable the choice from one of two loops for the optoisolator sequence that comprises the 7 minute pause during which the DVD player is in play mode. This switch wouldn't need to take place during the loop necessarily, as that would be a bit more complicated i imagine.
the code for the optoisolator looks like this:
' {$STAMP BS2sx}
' {$PBASIC 2.5}
inflate:
HIGH 0
PAUSE 30000
'30 sec
fan1:
HIGH 0
PAUSE 100
LOW 0
PAUSE 1900
HIGH 0
PAUSE 200
LOW 0
PAUSE 1800
HIGH 0
PAUSE 300
LOW 0
PAUSE 1700
HIGH 0
PAUSE 400
LOW 0
PAUSE 1600
HIGH 0
PAUSE 500
LOW 0
PAUSE 1500
HIGH 0
PAUSE 600
LOW 0
PAUSE 1400
HIGH 0
PAUSE 700
LOW 0
PAUSE 1300
HIGH 0
PAUSE 800
LOW 0
PAUSE 1200
HIGH 0
PAUSE 900
LOW 0
PAUSE 1100
HIGH 0
PAUSE 1000
LOW 0
PAUSE 1000
'20 sec
HIGH 0
PAUSE 1000
LOW 0
PAUSE 1000
HIGH 0
PAUSE 900
LOW 0
PAUSE 1100
HIGH 0
PAUSE 800
LOW 0
PAUSE 1200
HIGH 0
PAUSE 700
LOW 0
PAUSE 1300
HIGH 0
PAUSE 600
LOW 0
PAUSE 1400
'10 sec
'1 minute
LOW 0
PAUSE 3200
HIGH 0
PAUSE 2000
LOW 0
PAUSE 6500
HIGH 0
PAUSE 8700
LOW 0
PAUSE 4400
HIGH 0
PAUSE 4000
LOW 0
PAUSE 8000
HIGH 0
PAUSE 500
LOW 0
PAUSE 500
HIGH 0
PAUSE 5000
LOW 0
PAUSE 6000
HIGH 0
PAUSE 700
LOW 0
PAUSE 2000
HIGH 0
PAUSE 500
LOW 0
PAUSE 800
HIGH 0
PAUSE 800
LOW 0
PAUSE 2000
HIGH 0
PAUSE 800
LOW 0
PAUSE 3600
'2 minute
' ....etc, etc, etc,[noparse][[/noparse]
LOW 0
PAUSE 20000
'20 sec
'7 min
LOW 0
PAUSE 60000
PAUSE 35000
'35 sec
GOTO fan1
The fan is timed to mimic the speech from the DVD player by inflating a head shaped sculpture. I would like to have two fan sequences, one 'slouchier', and the other more 'perky', or one having a higher proportion of LOW state to the other, both sequences necessarily being the same 7'35" long. The fan state will be chosen via the toggle switch, which for simplicity's sake could be inactive when the basic stamp is on, that, or restart the whole process, whichever is easier.
Now, the above code, if you can call it that, represents about 90% of my knowledge of pBasic, so please forgive the following inevitable syntax picadillos, but i would imagine the code for the toggle UI to look something like this or express this basic idea. Assume the toggle switch connects 5v to either pin 1 or pin 2 and is only relevant when the basic stamp is off.:
if Pin 1 HIGH and Vss LOW
then GOTO fan1:
if Pin 2 HIGH and Vss LOW
then GOTO fan2:
Thanks
files.me.com/revelever/wgl5br
Also, I am interested in interfacing the BS2sx with a time keeping chip, (the 555?, or wht ever works) for the next project, wich will involve 5 dvd players, all of which need to be periodically triggered over the course of up to a few hours.
As Mike pointed out earlier, the BS2sx doesn't have enough I/O pins to control all of the buttons on 5 dvd players, some kind of matrix type conrtol, darlington array etc. is in order. There is more money in the budget for this one, and it all needs to be controlled by IR, but only to turn it on and off. Theoretically i could use more than one stamp, if necessary.