Go Down

Topic: Domino Clock (Read 12871 times) previous topic - next topic

stregoi

no unfortunately .. i did not work ! .. i ve trying to search in the internet but i couldn't find a good solution. so i hope you can give an idea

CrossRoads

I think what you're gonna need is 1 pair of drivers for each dot. Not sure you can share these across your 'motors'.
See figure 5 on page 9. The L293D has the diodes built in.
Each shift register will need an inverter added, like a 7404 type part, to create the Hi/Lo and Lo/Hi outputs for 1A and 2A. You  can likely use the signal that clocks the output register of the shift register as the Enable line, thus you disable the driver, shift out the new states, latch in and enable the driver at the same time.

You can try an experiment - see how long you need current applied for to switch the dots, and  if they stay in place if you stop applying current.  If so, multiplexing(sharing the current driver among dots) might be made to work.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

stregoi

That was an idea ... i have to buy the parts to make the experiment since i do not have equipment.
and i have no experience with multiplexing .. so i dont know how to do it yet ...

But your suggestion - if i undertood - is hook an inverter ( 7404 ) to the shift register  and from there to the high current driver ( ULN2008 ) ?

CrossRoads

Back up there - what happened to the L293?
If you have to apply current continuously to hold the dot in place, then you can't multiplex the driver.
Have you determined how much current is needed to flip the dots back & forth?

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

stregoi

yeah right the L293d i overlooked .. thanks for the schematics, i'll see how to hook it to the rest of the circuit.

I needed 9-12 V, 1A to flip the dots .. so using an external power wouldn't be a problem, i just have to calculate the power needed to power up 21 electromagnets.

As the deadline for the project is near ( school project - this weekend ), i have to change the design of the domino displaying method, so if i can't get the electromagnets to work i guess i will use servo-motors in stead  "the sketch " ( see the pic ) .. any suggestions ?

CrossRoads

#35
Mar 01, 2011, 01:33 am Last Edit: Mar 01, 2011, 01:36 am by CrossRoads Reason: 1
9-12V @ 1A to flip it? Wow! How is needed to hold it once flipped?

Maybe one of the little ones here?
http://www.hobby-lobby.com/sub_micro_servos_260_ctg.htm

I think you can multiplex these too. Connect power & ground to them all, then send a series if pulses to the one you want to move.
I think they will stay in place if there are no pulses.  Use the servo library, make a demux matrix to select where the pulses go.
If not, connect all the +power & control lines in parallel and use the ULN2803 to make the ground connection for the want you want to move.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

stregoi

Well once flipped, i don't need the power anymore since the magnet is attracted to the screw head, and the same things happens when reversing the Pole of the electromagnet.

Now for the servos .. sounds more achievable, you mentioned multiplexing, is it just as multiplexing LED's or should i Use a servo controller ? ( as here http://www.lynxmotion.com/p-395-ssc-32-servo-controller.aspx  ).

As for servo library, as far as i understood, reading the references is that it only supports 20 servo-motors .. am i wrong ?

i'll try to make a schematics and if it looks reasonable i will do some coding

stregoi

i Guess i will need an Arduino Mega ( being able to control up to 48 servo motors ) and the i have to hook one servo motor to one digital pin on the board. I will use a DS1307 as an external clock. and a couple of push buttons to set the hours and the minutes.

For the powering, as far as i understood from the references i read, and as you mentioned, so i have to put the ground for all servos together, and the power for all these together and connect them to an external power source with a power regulator.

it's my raisonnement right ?

what i have trouble understanding now, is how to use the buttons to set those servos ?
I''ll see if i can manage to write a primary code for the clock

CrossRoads

My thinking is that you use the servo library to get 1 dot working. Then you multiplex that 1 line across all the dots that you have so you can still use an Uno or similar (or make a standalone setup with the ATMega328, crystal, two 22pF caps pullup resistor, and a couple 0.1uF power decoupling caps - all available really inexpensively from www.dipmicro.com (are you in the US?).
Or, multiplex all the grounds with the servo control line (1A and 1A/) going to all the drivers, with maybe a buffer chip if the arduino can't control enough current for all of them (how many dots you have).

Power & ground connections - yes. If you can multiplex the grounds, then the current needed can enought to just for 1 magnet at time.
You use the buttons to set the DS1307 time, then you have a function to drive all the dots that need changing for example.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

stregoi

#39
Mar 01, 2011, 11:22 pm Last Edit: Mar 02, 2011, 01:58 am by stregoi Reason: 1
I guess i will save the "flip-project" for later, kind of upgrading the clock.

so for now i will stick with servos, i dont know how to multiplex, so i will use an arduino mega board ( i can use up to 48 servos ) i wrote this code for running the hole thing :
Code: [Select]
// include libraries

#include "Wire.h"
#include "Servo.h"

Servo *hourServos[] = {hour_servo1,  hour_servo2,  hour_servo3,  hour_servo4,  hour_servo5,  hour_servo6,  hour_servo7,  hour_servo8,  hour_servo9,  hour_servo10, hour_servo11, hour_servo12, hour_servo13, hour_servo14};

Servo *min_ten_Servos[] = {min_ten_servo1,  min_ten_servo2,  min_ten_servo3,  min_ten_servo4,  min_ten_servo5,  min_ten_servo6,  min_ten_servo7,  min_ten_servo8,  min_ten_servo9,  min_ten_servo10, min_ten_servo11, min_ten_servo12, min_ten_servo13, min_ten_servo14};

Servo *min_one_Servos[] = {min_one_servo1,  min_one_servo2,  min_one_servo3,  min_one_servo4,  min_one_servo5,  min_one_servo6,  min_one_servo7,  min_one_servo8,  min_one_servo9,  min_one_servo10, min_one_servo11, min_one_servo12, min_one_servo13, min_one_servo14};

#define DS1307_I2C_ADDRESS 0x68

// defining variables

int realhour = 0;
int hours = 0;
int minutes = 0;

// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
 return ( (val/10*16) + (val%10) );
}

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{
 return ( (val/16*10) + (val%16) );
}

void setDateDs1307(byte second,byte minute,byte hour,byte dayOfWeek,byte dayOfMonth,byte month,byte year)
{
 Wire.beginTransmission(DS1307_I2C_ADDRESS);
 Wire.send(0);
 Wire.send(decToBcd(second));    // 0 to bit 7 starts the clock
 Wire.send(decToBcd(minute));
 Wire.send(decToBcd(hour));    
 Wire.send(decToBcd(dayOfWeek));
 Wire.send(decToBcd(dayOfMonth));
 Wire.send(decToBcd(month));
 Wire.send(decToBcd(year));
 Wire.send(0x10); // sends 0x10 (hex) 00010000 (binary) to control register - turns on square wave
 Wire.endTransmission();
}

void getDateDs1307(byte *second, byte *minute, byte *hour, byte *dayOfWeek, byte *dayOfMonth, byte *month,byte *year)
{
 // Reset the register pointer
 Wire.beginTransmission(DS1307_I2C_ADDRESS);
 Wire.send(0);
 Wire.endTransmission();
 Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
 *second     = bcdToDec(Wire.receive() & 0x7f);
 *minute     = bcdToDec(Wire.receive());
 *hour       = bcdToDec(Wire.receive() & 0x3f);  
 *dayOfWeek  = bcdToDec(Wire.receive());
 *dayOfMonth = bcdToDec(Wire.receive());
 *month      = bcdToDec(Wire.receive());
 *year       = bcdToDec(Wire.receive());
}

// Function to Set time
/////
/////
////
/////

void setup() {

hour_servo1.attach(1);
hour_servo2.attach(2);
hour_servo3.ttach(3);
hour_servo4.attach(4);
hour_servo5.attach(5);
hour_servo6.attach(6);
hour_servo7.attach(7);
hour_servo8.attach(8);
hour_servo9.attach(9);
hour_servo10.attach(10);
hour_servo11.attach(11);
hour_servo12.attach(12);
hour_servo13.attach(13);
hour_servo14.attach(14);

min_ten_servo1.attach(1);
min_ten_servo2.attach(2);
min_ten_servo3.attach(3);
min_ten_servo4.attach(4);
min_ten_servo5.attach(5);
min_ten_servo6.attach(6);
min_ten_servo7.attach(7);
min_ten_servo8.attach(8);
min_ten_servo9.attach(9);
min_ten_servo10.attach(10);
min_ten_servo11.attach(11);
min_ten_servo12.attach(12);
min_ten_servo13.attach(13);
min_ten_servo14.attach(14);

min_one_servo1.attach(1);
min_one_servo2.attach(2);
min_one_servo3.attach(3);
min_one_servo4.attach(4);
min_one_servo5.attach(5);
min_one_servo6.attach(6);
min_one_servo7.attach(7);
min_one_servo8.attach(8);
min_one_servo9.attach(9);
min_one_servo10.attach(10);
min_one_servo11.attach(11);
min_one_servo12.attach(12);
min_one_servo13.attach(13);
min_one_servo14.attach(14);

 second = 0;
 dayOfWeek = 1;
 dayOfMonth = 24;
 month = 5;
 year = 10;

// Set up the time using the buttons then ->

setDateDs1307(second, minute, hour, dayOfWeek, dayOfMonth, month, year);


}

void loop() {

 byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
 getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
 realhour = int(hour);

 if (realhour==0) // if it is 0000h, that should be 1200h in 12 hour time
 {
   realhour=12;
 }

 if (hour>=13)
 {
     realhour=realhour-12; // convert 24h hours to 12h hours
 }

 hours=realhour*14;
 minutes=minute*3;

 minute_ten = minutes/10;
 minute_one = minutes%10;

 // hours case from 1 - 12
 // minute_ten from 1 - 5
 // minute_one from 1 - 9

   switch(hours) {
     case '1':
       hourServos[1].write(45);; // if active set position to 45 degree
       hourServos[2].write(0);; // if inactive set position to 0 degree
       break;
     case '2':
.
.
.
.

     case '12':
       .

       break;
   }

 delay(100);     // servos need time to move

   switch(minutes) {
     case '1':
       .

       break;
     case '2':
.
.
.
.

     case '60':
.

       break;
   }
 delay(100);

}


1 ) - i have problems setting time with buttons ... i cant figure out how to do it ?
it is specially, how can can get the servos to react when sitting the time .. so can visualize the time setting ( if that made sense )

any suggestions on how to do it ?

CrossRoads

Okay, as part of your void loop you're gonna have to read a button push, increment/decrement the relevant time element in the DS1307, then let the rest of the loop run to read the time normally and let the switch:case statements run to update the servo positions.
So it will be push, (whir), push, (whir), push, (whir),  etc.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

stregoi

Thank you .. here's what i come with ( i only done the hours, but i guess the minutes is same way ) ... does is seems right ?

Code: [Select]
int button_hour = 0;

void loop(){

  button_hour = digitalRead(button_hour_Pin); 


  if (button_hour == HIGH) {   
  time_t t = now();
  t = t + 3600;
RTC.set(t);
  setTime(t);

  }

    switch(hours) {
      case '1':
        hourServos[1].write(45);; // if active set position to 45 degree
        hourServos[2].write(0);; // if inactive set position to 0 degree
        break;
      case '2':
.
.
.
.
}

CrossRoads

Looks good.  You have a pulldown resistor on button_hour_Pin and you connect to +5 to bring it high?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

stregoi

yes i do .. for both the hour pin and the minutes pin .. i will post an update as soon as my servos and arduino mega comes

SpencerH

Hey guys!!
Wow this thing took off.
I was on a short internship so that's why I havent been online for quite a while.
Anyways i did have some trouble which had to do with the leds.
Basically they were not bright enough so I added two extra very bright leds but to no avail.
I added a voltage regulator to each board to deal with the current but F'ed them up aswell.
Either way I'll read through the thread and see if i can help anyone!!

Go Up