Sammy1Am / MoppyClassic

Moppy has been replaced with Moppy 2.0!
569 stars 190 forks source link

Possible to get the floppy drive to be activated by a sensor? #66

Closed 446f6d closed 9 years ago

446f6d commented 10 years ago

Hello everyone,

I am trying to get the floppy drive to play a MIDI track on loop but only when someone is near it. I was wondering if it is possible?

MultiDaxio commented 10 years ago

I am not sure, but you can try messing around in 'Moppyadvanced' code. Try the line about playing theusic. Set it like you want to. If you want it to play if someone is passing by, you have to change the input settings of the code. Hope I have helped. -MultiDaxio

MultiDaxio commented 10 years ago

New idea. If you want to make some kind of doorbell/alarm system/i have no idea what else, you can make your sensor work as a power switch. But in this case your pc/laptop with moppyadvanced have to be always on. Plus, your song must be looped endlessly (see issue 65 or 64, I do not remeber ( that is not healthy for the Arduino processor though )). Attach the sensor to the power cord of ATX power supply to control whether ( idk if I spelled that correctly ) floppies are on, whether off. Hope I have helped -MultiDaxio

jazzbassNick commented 10 years ago

I was thinking that since the computer would be on, whatever it is that's monitoring the proximity sensor could trigger the start loop. You'd probably need to put a hook into the Moppy code to accept a programmatic "start".

My other thought is to put the proximity sensor on a mini board (like a perf board) between the drives and arduino. Have all the drives wired to the mini board and have all your arduino connections wired to mini board on the other side of the proximity sensor. Computer could continue to loop, since the arduino is constantly connected, and with the sensor makes the connection the drives play.

Good luck with it - be fun to see what you come up with.

MultiDaxio commented 10 years ago

Yeah jazzbassNick. Imagine, you are knockin' to that guys house. Suddenly a Floppirial March starts (get it ? :) ). Then, he comes up dressed like Lord Vader. 'I am your father(board)!'

Lame jokes are lame. Apologies.

jazzbassNick commented 10 years ago

No apologies needed - sometimes a guy just can't help himself... ;)

On Thu, May 1, 2014 at 12:32 PM, MultiDaxio notifications@github.comwrote:

Yeah jazzbassNick. Imagine, you are knockin' to that guys house. Suddenly a Floppirial March starts (get it ? :) ). Then, he comes up dressed like Lord Vader. 'I am your father(board)!'

Lame jokes are lame. Apologies.

— Reply to this email directly or view it on GitHubhttps://github.com/SammyIAm/Moppy/issues/66#issuecomment-41947238 .

MultiDaxio commented 10 years ago

That's what she said :D

446f6d commented 10 years ago

Hey guys, thanks for the help, I got the drive to loop endlessly as I mentioned in the previous issue. I tried using the sensor as a power switch by editing the arduino code with an if else statement but all that does is move the stepper motor on the drive a little bit when someone is near.'

I am not sure if I should edit the code in Moppy advanced or in arduino as I am fairly new to this stuff as well D:

MultiDaxio commented 10 years ago

Maybe you should place a NOR gate at ATX power cord. It will reverse signal.

446f6d commented 10 years ago

MultiDaxio, I'm powering the floppy with the arduino board though and I'm not too familiar with NOR gates.

Jazzbassnick, you mentioned something about whatever that is triggering the sensor to start the loop, do I do that in the arduino code or the moppy advanced code in Java?

tg44 commented 10 years ago

Hy, there, if you dont need to start the music from the start, there is an easy solution. You only need to take the sensor to the drive-enable line. 0 programing, just some comparator. You coud take the switch sensor to the atx power (i dont think its healthy...). Maybe to the arduino power (its not healthy but you cuold use the new comport coming as a trigger event in java to start. These are the "hack the life" methods...

The elegant method coud be if you connect the sensor to a computer and modify the java code, or connect it to the arduino and make a 2way communication between the java and the arduino, so the arduino coud send start-stop messages to the java too.

The more "I woud do it" solution is the drive-enable and the 2way communication, but all the solutions above coud work.

MultiDaxio commented 10 years ago

About gates. You have different types of gates: AND will send signal if two out of two inputs are powered (or have signal), OR needs only one input to have signal. Also you can use N-type gates (NAND, NOR, NOT) which reverse the output signal: if NAND have signal on both inputs it will not give response, NOR will give you signal if any of the inputs are not powered, finally NOR gate, it simply reverses the signal, if you power something that has NOR plugfed into it, it will be off. 1 - signal 0 - no signal input input - output AND: 0 0 - 0 0 1 - 0 1 1 - 1 OR: 0 0 - 0 0 1 - 1 1 1 - 1 NAND: 0 0 - 1 0 1 - 1 1 1 - 0 NOR: 0 0 - 1 0 1 - 0 1 1 - 0 NOT (it has only one input): 0 - 1 1 - 0 Get it? Google may be also helpful, serach for 'logic gates' or 'electronic gates'.

MultiDaxio commented 10 years ago

Forgot about X-type gates (XAND, XOR, XNOT) but they are waaaaay more complicated than previous ones plus they will not be useful in thy contraption.

jazzbassNick commented 10 years ago

@446f6d I would think you would be modifying the Java code. Here's how I'm thinking of it:

I've got a motion sensor with a built-in timer that is used for outside lights laying around in my garden shed. Maybe I'll give it a go, but it wouldn't be until next week sometime.

Hope that helps. I may be totally off base on all of it, but at 4:30a that's what I got ;)

MultiDaxio commented 10 years ago

Good idea, but when I said about power shifting, I meant turning on and off floppies, not Arduino. It might not be healthy for hardware though...

Sammy1Am commented 10 years ago

If you're going with connecting the motion detector on the hardware-side of things (instead of getting the PC to start and stop the playback) then I think @tg44 's suggestion of using the drive-select pins is going to be your best bet.

Rather than having the drive-select pins always grounded, you could just float them, and use the motion detector to connect them to ground. This will be faster, and probably safer, than switching the actual power for the drives on and off. The Arduino and PC would continue to happily communicate, and the Arduino would keep sending messages to the drives, but they would just ignore them unless motion is detected.

However, because the Arduino is actually keeping track of the position of the read head itself, any solutions that stop the drives without also stopping playback, will result in the heads "bottoming out" the next time they start playing. This doesn't seem to hurt the drives too much, as it seems they are designed to recover from that sort of situation, but it doesn't sound pretty. =P They'll be back in sync after the first direction change though, so it may still be doable.

MultiDaxio commented 10 years ago

So mid-stopping floppies is not killing them? -MultiDaxio

2014-05-02 20:10 GMT+02:00 SammyIAm notifications@github.com:

If you're going with connecting the motion detector on the hardware-side of things (instead of getting the PC to start and stop the playback) then I think @tg44 https://github.com/tg44 's suggestion of using the drive-select pins is going to be your best bet.

Rather than having the drive-select pins always grounded, you could just float them, and use the motion detector to connect them to ground. This will be faster, and probably safer, than switching the actual power for the drives on and off. The Arduino and PC would continue to happily communicate, and the Arduino would keep sending messages to the drives, but they would just ignore them unless motion is detected.

However, because the Arduino is actually keeping track of the position of the read head itself, any solutions that stop the drives without also stopping playback, will result in the heads "bottoming out" the next time they start playing. This doesn't seem to hurt the drives too much, as it seems they are designed to recover from that sort of situation, but it doesn't sound pretty. =P They'll be back in sync after the first direction change though, so it may still be doable.

— Reply to this email directly or view it on GitHubhttps://github.com/SammyIAm/Moppy/issues/66#issuecomment-42060887 .

Adam

Sammy1Am commented 10 years ago

It's probably not killing them. ;P

The drives that I have automatically cut out if you try to move the head too far toward the motor; I assume so that it's easy to reset the drives to their starting positions. However if you step too far away from the motor, the head can't move any further, but the little plastic bit that connects the head to the drive gear seems designed to click over the gear rather than allow the drive to destroy itself. Doing this repeatedly is probably not great for the drives, but I've also yet to have any drive break on me through all my testing (except the one where I put a screw through the circuit board accidentally, but that one's understandable).

MultiDaxio commented 10 years ago

Speaking of wrecking floppies... do not leave the dog alone in room with your Moppy-floppy contraption. It is a miracle that he did not eat my Arduino...

2014-05-02 20:25 GMT+02:00 SammyIAm notifications@github.com:

It's probably not killing them. ;P

The drives that I have automatically cut out if you try to move the head too far toward the motor; I assume so that it's easy to reset the drives to their starting positions. However if you step too far away from the motor, the head can't move any further, but the little plastic bit that connects the head to the drive gear seems designed to click over the gear rather than allow the drive to destroy itself. Doing this repeatedly is probably not great for the drives, but I've also yet to have any drive break on me through all my testing (except the one where I put a screw through the circuit board accidentally, but that one's understandable).

— Reply to this email directly or view it on GitHubhttps://github.com/SammyIAm/Moppy/issues/66#issuecomment-42062466 .

Adam

446f6d commented 10 years ago

@SammyIAM, you mentioned something about floating the drive select pins, may I know how do I do that? The drive select pins are connected to each other right?

MultiDaxio commented 10 years ago

Floating means plugging and unplugging ground (GND) pins. Just drag out your groumd pim when it is not in use (watch Sammy's tutorial to know it :) ).

tg44 commented 10 years ago

Yeah. If u change them from grounded they will simply not working. Its like a super switch for the other options in the driver. If those pins floating the whole driver array will deny any of the incoming control.

MultiDaxio commented 10 years ago

At least most of them, cause some of them notes actually DO NOT need to be grounded ( first notes only, when drives' heads are moving forward and cannot go much further.

MultiDaxio commented 10 years ago

Dude, try connecting borh methods. Plase your sensor on ground wire from floppy ( you need only one to be connected to GND on Arduino ) and make it float, untill someone passes by.

446f6d commented 10 years ago

@MultiDaxio, I am currently using this sensor: http://www.robot-electronics.co.uk/htm/srf05tech.htm

Does that mean I attach the echo pin of the sensor to the ground pin of the drive select?

MultiDaxio commented 10 years ago

Not drive select, but Arduinos' GND pin. You have to make GND float when noone is neae your device.

Sammy1Am commented 10 years ago

Alright, let's clarify something: I may have somewhat misused "float" from a technical perspective. What I meant to say was that when you don't want your drive to be playing, the drive select pin shouldn't be connected to anything at all (or alternatively, I think it's probably safe to connect it to a "HIGH" pin on the Arduino, since that's what we're doing on the step and direction pins). When the drive select pin is connected to ground, the drive becomes "selected" and it will respond to input. Do not disconnect your Arduino's ground from the circuit, since this will prevent the circuit from operating correctly.

@446f6d , based on the link you posted, you're going to have to do some post-processing on the data from the SRF05 before connecting to the floppy drives. The "echo" pulse changes in length depending on how close an object is. You'll have to measure how long the pulse lasts, and determine if its length is different than the "resting" length (since even if no one is present in the room, the SRF05 is likely to measure some sort of distance (to a wall or something). If it's less than the normal amount, you can turn on the floppy drives (using whatever method you settle on) until one or more of the echo pulses you receive is back to the normal resting length.

446f6d commented 10 years ago

@SammyIAm I have done something in the arduino code to check on echo pulse changes. So I am assuming I will have to make an if else statement to change the ground pin for the drive select to HIGH/LOW?

Sammy1Am commented 10 years ago

I think that will work just fine. You'll probably want some sort of time-out / countdown sort of function too so that the drives will play for a certain amount of time after motion is detected. Otherwise the person in the room would have to continuously dance to listen to the music... unless maybe that's what you're going for =P

446f6d commented 10 years ago

@SammyIAm hmm, I made an if else statement for the sensor, so if an object is within 10cm of it, the drive will play. It somewhat works but the problem now is that the drive just plays a single note repeatedly. I connected the drive select pin on the drive to arduino's digital pin 13.

MultiDaxio commented 10 years ago

Do you have any software (drivers, etc.) with your sensor?

446f6d commented 10 years ago

@MultiDaxio there are no drivers or software with the sensor. It is just a simple ultrasonic rangefinder

Sammy1Am commented 9 years ago

I'm closing this since there is no lingering "issue", but feel free to continue to use it as a discussion place.