Arduino floppy music

Mi sto cimentando in arduino moppy, per chi non lo conosce serve per far suonare a dei floppy delle musiche in midi, il programma lo so usare qualcosa di java lo conosco ma sono bloccato alla parte hardware cioe so quali pin prendere dal floppy pero dopo non so dove collegarli, sulla guida dice di collegarli ai digitapin 2 al 17 ma io non ce li ho tutti quei pin poi il 13 è gia usato per il led ma non so quali prendere sono quelli pwm o quelli digitali o quelli analogici? non so dove sbattere la testa

questo è quello che dice la guida

I built Moppy using an Arduino UNO, though it should work just fine on most Arduinos. The pins are connected in pairs to floppy drives as follows: Even pins (2,4,6...) are connected to each drive's STEP pin, the matching odd pins (3,5,7...) are connected to the each drive's DIRECTION control pin. So the first floppy would be connected to pin 2 & 3, the second floppy to 4 & 5, and so on.

Some pinout information can be found here: Floppy Diskdrive pinout and wiring @ old.pinouts.ru

Make sure you ground the correct drive-select pin, or the drive won't respond to any input (just connect the drive-select pin on the floppy to the pin directly below it). You can tell when you have the right drive selected, because the light on the front of the drive will come on.

Also, it's VERY IMPORTANT that your Arduino is grounded with the drives, or the drives will not register the pulses correctly. To do this, make sure that the GND pin on the Arduino is connected to the odd-numbered pin below the STEP pin on the floppy (i.e. if the STEP pin is 20, connect the Audnio's GND pin to Floppy-pin 19). You might need to do this for the DIRECTION pin as well (I did it for both, but I don't know if it's required).

spero che possiate aiutarmi e scusate se vi ho fatto perdere tempo per una domanda cosi stupida

I pin dell'Arduino dal 14 al 19 sono i pin analogici A0..A5.
Il pin 13 ha effettivamente un led ma è su una linea parallela sulle Arduino 2009 e UNO R1/R2 mentre è gestito tramite un opamp sulla UNO R3. Non dovrebbe darti noia più di tanto. Al max usa uno dei pin analogici liberi.

vale anche per l'arduino atmega 2560 he invece va da a0 ad a15 ? a parte che cosa volere di piu quando controlli 8 floppy e gia un delirio

ma non fai prima con 3 stepper?

Progetti con i floppy non ho mai visto nulla googlando, con ATAPI controller for a CD-ROM drive qualcosa qui
http://singlevalve.web.fc2.com/Atapiduino/atapiduino.htm

ciao

questo e' un genio, e' un progetto open ?

ce lo fatta suona tetris l'unico problema e che ho solo un lettore floppy se qualcun altro vuole cimentarsi in questo progetto posso aiutare

tizio45:
ce lo fatta suona tetris l'unico problema e che ho solo un lettore floppy se qualcun altro vuole cimentarsi in questo progetto posso aiutare

molto bene, sono contento per te, però un floppy è da 1,44 Mgb contro una chiavetta usb più piccola e più capiente, interessante come progetto, ma non credo sia di grande utilità come nemmeno usare un cd-rom ]:smiley:

pablos:
molto bene, sono contento per te, però un floppy è da 1,44 Mgb contro una chiavetta usb più piccola e più capiente, interessante come progetto, ma non credo sia di grande utilità come nemmeno usare un cd-rom ]:smiley:

Il 90% dei progetti che girano in questo ambiente sono generalmente antieconomici, inutili e non pratici, fatti solo per puro divertimento o per scommessa personale: però è il loro bello! XD

leo72:
sono generalmente antieconomici, inutili e non pratici, fatti solo per puro divertimento o per scommessa personale

Cioè una cosa come questa ? :smiley:

bello comunque per chiudere il discorso i digital pin dal14 al 17 sono quelli dell analog A0 A3

questo è lo sketch quello che non capisco è che usa il pin 13 per il led ma anche per il direction del 6 lettore floppy
ma programmando cosi arduino si dice gia alla scheda che volgio che i pin a0 -a3 siano pin in uscita?

#include <TimerOne.h>

boolean firstRun = true; // Used for one-run-only stuffs;

//First pin being used for floppies, and the last pin. Used for looping over all pins.
const byte FIRST_PIN = 2;
const byte PIN_MAX = 17;
#define RESOLUTION 40 //Microsecond resolution for notes

/NOTE: Many of the arrays below contain unused indexes. This is
to prevent the Arduino from having to convert a pin input to an alternate
array index and save as many cycles as possible. In other words information
for pin 2 will be stored in index 2, and information for pin 4 will be
stored in index 4.
/

/*An array of maximum track positions for each step-control pin. Even pins
are used for control, so only even numbers need a value here. 3.5" Floppies have
80 tracks, 5.25" have 50. These should be doubled, because each tick is now
half a position (use 158 and 98).
*/
byte MAX_POSITION[] = {
0,0,158,0,158,0,158,0,158,0,158,0,158,0,158,0,158,0};

//Array to track the current position of each floppy head. (Only even indexes (i.e. 2,4,6...) are used)
byte currentPosition[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

/*Array to keep track of state of each pin. Even indexes track the control-pins for toggle purposes. Odd indexes
track direction-pins. LOW = forward, HIGH=reverse
*/
int currentState[] = {
0,0,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW,LOW
};

//Current period assigned to each pin. 0 = off. Each period is of the length specified by the RESOLUTION
//variable above. i.e. A period of 10 is (RESOLUTION x 10) microseconds long.
unsigned int currentPeriod[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};

//Current tick
unsigned int currentTick[] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};

//Setup pins (Even-odd pairs for step control and direction
void setup(){
pinMode(13, OUTPUT);// Pin 13 has an LED connected on most Arduino boards
pinMode(2, OUTPUT); // Step control 1
pinMode(3, OUTPUT); // Direction 1
pinMode(4, OUTPUT); // Step control 2
pinMode(5, OUTPUT); // Direction 2
pinMode(6, OUTPUT); // Step control 3
pinMode(7, OUTPUT); // Direction 3
pinMode(8, OUTPUT); // Step control 4
pinMode(9, OUTPUT); // Direction 4
pinMode(10, OUTPUT); // Step control 5
pinMode(11, OUTPUT); // Direction 5
pinMode(12, OUTPUT); // Step control 6
pinMode(13, OUTPUT); // Direction 6
pinMode(14, OUTPUT); // Step control 7
pinMode(15, OUTPUT); // Direction 7
pinMode(16, OUTPUT); // Step control 8
pinMode(17, OUTPUT); // Direction 8

Timer1.initialize(RESOLUTION); // Set up a timer at the defined resolution
Timer1.attachInterrupt(tick); // Attach the tick function

Serial.begin(9600);
}

void loop(){

//The first loop, reset all the drives, and wait 2 seconds...
if (firstRun)
{
firstRun = false;
resetAll();
delay(2000);
}

//Only read if we have
if (Serial.available() > 2){
//Watch for special 100-message to reset the drives
if (Serial.peek() == 100) {
resetAll();
Serial.flush();
}
else{
currentPeriod[Serial.read()] = (Serial.read() << 8) | Serial.read();
}
}
}

/*
Called by the timer inturrupt at the specified resolution.
/
void tick()
{
/

If there is a period set for control pin 2, count the number of
ticks that pass, and toggle the pin if the current period is reached.
*/
if (currentPeriod[2]>0){
currentTick[2]++;
if (currentTick[2] >= currentPeriod[2]){
togglePin(2,3);
currentTick[2]=0;
}
}
if (currentPeriod[4]>0){
currentTick[4]++;
if (currentTick[4] >= currentPeriod[4]){
togglePin(4,5);
currentTick[4]=0;
}
}
if (currentPeriod[6]>0){
currentTick[6]++;
if (currentTick[6] >= currentPeriod[6]){
togglePin(6,7);
currentTick[6]=0;
}
}
if (currentPeriod[8]>0){
currentTick[8]++;
if (currentTick[8] >= currentPeriod[8]){
togglePin(8,9);
currentTick[8]=0;
}
}
if (currentPeriod[10]>0){
currentTick[10]++;
if (currentTick[10] >= currentPeriod[10]){
togglePin(10,11);
currentTick[10]=0;
}
}
if (currentPeriod[12]>0){
currentTick[12]++;
if (currentTick[12] >= currentPeriod[12]){
togglePin(12,13);
currentTick[12]=0;
}
}
if (currentPeriod[14]>0){
currentTick[14]++;
if (currentTick[14] >= currentPeriod[14]){
togglePin(14,15);
currentTick[14]=0;
}
}
if (currentPeriod[16]>0){
currentTick[16]++;
if (currentTick[16] >= currentPeriod[16]){
togglePin(16,17);
currentTick[16]=0;
}
}

}

void togglePin(byte pin, byte direction_pin) {

//Switch directions if end has been reached
if (currentPosition[pin] >= MAX_POSITION[pin]) {
currentState[direction_pin] = HIGH;
digitalWrite(direction_pin,HIGH);
}
else if (currentPosition[pin] <= 0) {
currentState[direction_pin] = LOW;
digitalWrite(direction_pin,LOW);
}

//Update currentPosition
if (currentState[direction_pin] == HIGH){
currentPosition[pin]--;
}
else {
currentPosition[pin]++;
}

//Pulse the control pin
digitalWrite(pin,currentState[pin]);
currentState[pin] = ~currentState[pin];
}

//
//// UTILITY FUNCTIONS
//

//Not used now, but good for debugging...
void blinkLED(){
digitalWrite(13, HIGH); // set the LED on
delay(250); // wait for a second
digitalWrite(13, LOW);
}

//For a given controller pin, runs the read-head all the way back to 0
void reset(byte pin)
{
digitalWrite(pin+1,HIGH); // Go in reverse
for (byte s=0;s<MAX_POSITION[pin];s+=2){ //Half max because we're stepping directly (no toggle)
digitalWrite(pin,HIGH);
digitalWrite(pin,LOW);
delay(5);
}
currentPosition[pin] = 0; // We're reset.
digitalWrite(pin+1,LOW);
currentPosition[pin+1] = 0; // Ready to go forward.
}

//Resets all the pins
void resetAll(){

// Old one-at-a-time reset
//for (byte p=FIRST_PIN;p<=PIN_MAX;p+=2){
// reset(p);
//}

// New all-at-once reset
for (byte s=0;s<80;s++){ // For max drive's position
for (byte p=FIRST_PIN;p<=PIN_MAX;p+=2){
digitalWrite(p+1,HIGH); // Go in reverse
digitalWrite(p,HIGH);
digitalWrite(p,LOW);
}
delay(5);
}

for (byte p=FIRST_PIN;p<=PIN_MAX;p+=2){
currentPosition[p] = 0; // We're reset.
digitalWrite(p+1,LOW);
currentState[p+1] = 0; // Ready to go forward.
}

astrobeed:
Cioè una cosa come questa ? :smiley:

Astro ma e' una cosa eccezionale, e' impressionante, mi sto' schiantando dal ridere :stuck_out_tongue_closed_eyes:

credo sia anche difficile, deve muoversi sui 3 assi

sembra incazzarsi :slight_smile:

x Tizio45:

il fatto che sul 13 ci sia il led non ti comporta problemi, fara' cio' che deve fare ed in piu' accendera' il led.
e' inutile dichiararlo due volte quindi elimina la prima riga

pinMode(13, OUTPUT);// Pin 13 has an LED connected on most Arduino boards

per i pin analogici non c'e' differenza se li chiami A0 o 14, infatti sono dichiarati qui:

  pinMode(14, OUTPUT); // Step control 7
  pinMode(15, OUTPUT); // Direction 7
  pinMode(16, OUTPUT); // Step control 8
  pinMode(17, OUTPUT); // Direction 8

risolto a caso ho provato con un pezzo di traccia mid e i pin 14-15-16-17 sono quelli relativi alla parte conecction gli rx-tx un orchestra di floppy al mio comando nuhahahahaha oggi questo domandi un robo che conquistera il mondo

grazie di tutto

Ma scusa fammi capire il suono lo ottieni col movimento della testina? o caricare un file midi dal floppy?
ciao

su arduino ho caricato lo schetch che ho pubblicato, dopo tramite un programma carico un applicativo java legge un file midi e in base alle note dei canali (in questo momento ne legge fino ad otto) manda dei comandi ad arduino che controlla gli stepmotors dei floppy, il rumore che senti non è altro che la testina cha va avanti e indietro

questo progetto e' sfiziosdissimo, ma c'e' un sito dove e' pubblicato ? o almeno un video youtube ?
in modo da vaderlo e sentirlo

be di video ne trovi quanti ne vuoi questo è il sito del tipo che lo ha progettato GitHub - Sammy1Am/Moppy2: The evolution of the Musical flOPPY controller

scusate ancora dato che il progetto è stato concepito per arduino UNO dove i pin dal 14 al17 sono gli A1-A5 e io ho un arduino mega 2560 e i pin 14-17 ci sono e sonno nella sezione communication sono dei tx-rx come i pin 0 e 1 dovrebbero funzionare lo stesso in teoria giusto

si funziona lo stesso perche' non usi quei pin come seriali