Construction of Word Clock v1

Rasprava o AVR mikrokontrolerima, AVR projekti i drugo vezano za AVR...

Moderators: pedja089, stojke369, trax, InTheStillOfTheNight

Post Reply
MIICHALUS
Posts: 3
Joined: 30-03-2015, 14:12

Re: Construction of Word Clock v1

Post by MIICHALUS »

Yes I read it and tried this way but this shifting of bits does not work(moved bits appears in completely different positionn)
That's why i asked for a help.
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

Have you tried the "main()" function for this, as I suggested on the first page?
This mapping is done for rows, and for columns - separately.

I realize that the schematics for the LEDs are missing from the project, and this poses a problem for anyone who wants to build this clock. To solve that, here is the final "max72xx_send_matrix()" function:

Code: Select all

// send "data matrix" array to all MAXes
void max72xx_send_matrix()
{
    uint8_t max_id, j, max_addr;

    // since MAXes and LEDs are arranged in a funky way, we need to "transform" the data_matrix array before sending it to MAXes
    uint8_t display_matrix_new[MAX72XX_COUNT][8];

    // copy and do some transformations because LED matrices are soldered in a funky way onto the MAX chips :)
    // MAX7219 RE-MAPPING CODE:
    for(max_id=0; max_id<MAX72XX_COUNT; max_id++) // for each MAX chip
    {
        for(j=0; j<8; j++) // and each MAX accepts 8 bytes
        {
            // MAX1 and MAX4 are soldered in the same fashion
            if(max_id==0 || max_id==3)
            {
                uint8_t old_byte = display_matrix[max_id][j];

                // now rearrange the bits into a new byte
                uint8_t new_byte = 0;
               
                new_byte |= (old_byte & 0b00000001) <<6;
                new_byte |= (old_byte & 0b00000010) ;
                new_byte |= (old_byte & 0b00000100)<<3;
                new_byte |= (old_byte & 0b00001000) >>3;
                new_byte |= (old_byte & 0b00010000) ;
                new_byte |= (old_byte & 0b00100000) >>3;
                new_byte |= (old_byte & 0b01000000) <<1;
                new_byte |= (old_byte & 0b10000000) >>4;

                // now rearrange the indexes
                uint8_t new_index = 0; // =0 because of compiler warning
                switch (j)
                {
                    /*case 0: new_index=0; break;
                    case 1: new_index=4; break;
                    case 2: new_index=6; break;
                    case 3: new_index=2; break;
                    case 4: new_index=3; break;
                    case 5: new_index=7; break;
                    case 6: new_index=5; break;
                    case 7: new_index=1; break;*/
                   
                    case 0: new_index=1; break;
                    case 1: new_index=5; break;
                    case 2: new_index=7; break;
                    case 3: new_index=3; break;
                    case 4: new_index=2; break;
                    case 5: new_index=6; break;
                    case 6: new_index=4; break;
                    case 7: new_index=0; break;
                }

                display_matrix_new[max_id][new_index] = new_byte;
            }
            // and MAX2 and MAX3 are soldered in the same fashion
            else
            {
                uint8_t old_byte = display_matrix[max_id][j];

                // now rearrange the bits into a new byte
                uint8_t new_byte = 0;
                    new_byte |= (old_byte & 0b00000001)<<3;
                    new_byte |= (old_byte & 0b00000010)<<6;
                    new_byte |= (old_byte & 0b00000100);
                    new_byte |= (old_byte & 0b00001000)<<1;
                    new_byte |= (old_byte & 0b00010000)>>4;
                    new_byte |= (old_byte & 0b00100000);
                    new_byte |= (old_byte & 0b01000000)>>5;
                    new_byte |= (old_byte & 0b10000000)>>1;
                // now rearrange the indexes
                uint8_t new_index = 0; // =0 because of compiler warning
                switch (j)
                {
                    /*case 0: new_index=1; break; // ili je 5 ili je 1
                    case 1: new_index=5; break; // ili je 1 ili je 5
                    case 2: new_index=7; break;
                    case 3: new_index=3; break;
                    case 4: new_index=2; break;
                    case 5: new_index=6; break;
                    case 6: new_index=4; break;
                    case 7: new_index=0; break;*/
                   
                    case 0: new_index=0; break; // ili je 5 ili je 1
                    case 1: new_index=4; break; // ili je 1 ili je 5
                    case 2: new_index=0; break;
                    case 3: new_index=4; break;
                    case 4: new_index=6; break;
                    case 5: new_index=2; break;
                    case 6: new_index=3; break;
                    case 7: new_index=7; break;
                }

                display_matrix_new[max_id][new_index] = new_byte;
            }
        }
    }

    // finally send the new display matrix to all MAXes
    for(max_id=1; max_id<=MAX72XX_COUNT; max_id++)
    {
        for(j=0, max_addr=0x01; j<8; j++, max_addr++)
        {
            max72xx_write(max_id, max_addr, display_matrix_new[max_id-1][j]); // send appropriate data to appropriate MAX :)
        }
    }

    return;
}
and in the attachment you can find schematics of how to connect LEDs to MAX chips. If you don't want to change the code to fit your current wiring, please use this schematics and re-arrange wires you soldered (if you already soldered them) on MAX chips so that it look this way.

Let me know if you need anything else.
Attachments
LED_matrix_schematics_CADSOFT_Eagle.zip
(68.03 KiB) Downloaded 784 times
MIICHALUS
Posts: 3
Joined: 30-03-2015, 14:12

Re: Construction of Word Clock v1

Post by MIICHALUS »

Thank You very much for the help
The matrix works excellent right now:)
Still i have to solve some problems with touch sensor but it is different kind of story:)
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

I am glad you solved the problem :)
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

For anyone interested in v2 of the clock (minor changes - different pinout and small changes in firmware, nothing worth mentioning) - here is the attachment.
wc_v2.rar
Word Clock v2.
(148.63 KiB) Downloaded 740 times
User avatar
hitch
Posts: 5
Joined: 27-11-2016, 12:33
Location: Somewhere on the Pale Blue Dot

Re: Construction of Word Clock v1

Post by hitch »

Great clock! I'm planning to make my own although with a few changes because I like to have rgb colors and because I'm Dutch I'll change the language :). However I do have a question. You've created this clock some time ago and you glued the back of the clock to the vinyl which is attached to the glass. Does this stay together after all this time? Are there things you would do different when you look back on it?
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

Hi,
Yes, the clock is still on the wall working super :-)
Things you might consider:

1. I would find someone with CNC to route all the wood.
2. Do not glue the front panel to the wood. Use strong Neodymium magnets and maybe plexiglass (plastic, not glass) because it is lighter for the magnets.

I guess that's it :-)

Regards!
User avatar
hitch
Posts: 5
Joined: 27-11-2016, 12:33
Location: Somewhere on the Pale Blue Dot

Re: Construction of Word Clock v1

Post by hitch »

The project page gives some good arguments for using glass instead of plexiglass and says that the front and back were glued to each other. I really like the sleek front of your clock, putting magnets in the plexiglass would change that (a bit) so I'm having some doubts about that. So what disadvantages have you seen in you current design?
User avatar
hitch
Posts: 5
Joined: 27-11-2016, 12:33
Location: Somewhere on the Pale Blue Dot

Re: Construction of Word Clock v1

Post by hitch »

hitch wrote:The project page gives some good arguments for using glass instead of plexiglass and says that the front and back were glued to each other. I really like the sleek front of your clock, putting magnets in the plexiglass would change that (a bit) so I'm having some doubts about that. So what disadvantages have you seen in your current design?
And another question, how did you get the inactive characters so dark in your v2 clock? Is it an extra dark foil between the screen and the tracing paper? If so, how has the brightness of the LED's changed?
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

Well, I have no regrets of my design except the ones I statet above :) No problems whatsoever. Also, I would use whole PCB or 4 larger PCBs to hold the LEDs - I would not use those small PCBs and connect them with wires. That's a lot of work...

Magnets would not affect the design at all, because they would be invisible. You would glue 4 (or more) magnets to the front panel on the inside (actually to the word-foil). After that, you would drill the wood and place accepting magnets deeper (and glue them to the wood). When the front panel joins the wood those magnets would stick together - that's it.

Regarding the darkening - yes, I used car window tinting foil (high quality) with 25% tinting. I glued it directly to the glass, then word-foil to that foil. After that comes the tracing paper which is glued not to the front panel, but to the wood, only above the holes for LEDs.
User avatar
hitch
Posts: 5
Joined: 27-11-2016, 12:33
Location: Somewhere on the Pale Blue Dot

Re: Construction of Word Clock v1

Post by hitch »

Great, I'm now thinking about using tinted plexiglass like this (https://www.plexiglas-shop.com/GB/en/de ... aql41br8z4). That would also do the job nicely.
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

Sure, I don't see why not. It says "21.0% Transmission" so I guess it means that it blocks 79% of light. You would probably want the opposite it I am not mistaking. You need it just a little tinted and more transparent.

update:
wow, it is also expensive :)
User avatar
hitch
Posts: 5
Joined: 27-11-2016, 12:33
Location: Somewhere on the Pale Blue Dot

Re: Construction of Word Clock v1

Post by hitch »

indeed, very expensive and you're correct about the transmission percentage. I've already found a cheaper (Dutch) web shop to get it, however they don't say how much of the light is blocked so I've send them an email about that. I'm glad you can now get all the light strips, magnets and other stuff very cheap from aliexpress :D. That will keep the costs down.
logr
Posts: 12
Joined: 23-02-2017, 13:14

Re: Construction of Word Clock v1

Post by logr »

Bok.
Zanima me dali se DS3232/DS3231 moze zamjeniti sa DS3232MZ+RTC (8pin) pošto ih je teže nabaviti. U spec. piše da je kompatibilan. Ako je ok , osim promjene pin layout dali bi ista bilo potrebno mjenjati u firmwaru?
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

Nisam koristio tu verziju, ali ako je kompatibilan (softverski i hardverski) onda slobodno probaj. Nebi trebalo da ista mijenjas.
Ako ima razlika u protokolu onda ces morati prepravljati firmware!
logr
Posts: 12
Joined: 23-02-2017, 13:14

Re: Construction of Word Clock v1

Post by logr »

Ipak sam uspio naruciti ds3231. Što se tice firmwera mora li biti na cistom atmeg328 bez boot lodera i dodaje se u FLASH ili EEPROM ?
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

Mozes kupiti kakav god zelis ATmega328P. Njega ces isprogramirati koristeci AVR programator (neki kojeg imas) i prilozeni HEX fajl u projektu kojeg si downloadovao. EEPROM nema potrebe da programiras sa programatorom.
logr
Posts: 12
Joined: 23-02-2017, 13:14

Re: Construction of Word Clock v1

Post by logr »

Trax hvala na pomoči. Do sad sam tek uspio napraviti main PCB i jedan Matrix PCB. Pokušao sam uplodat hex file, kombinacija wc1 i koda matrix wc2. testirao sam sa samo jednim matrixom i led-ice samo zabljesnu jedanput i ugase se. Probao sam testirati matrix i sa arduinom uno sa drugim fileom za arduino i ista stvar. jedino sto je drugačije od orginala je otpornik R4 ,14K3.
Početnik sam u oveme pa ako može neki savjet šta bih mogao prvo gledat. Hvala.
User avatar
trax
Administrator sajta
Administrator sajta
Posts: 3509
Joined: 08-01-2005, 18:04
Location: 75k, BA
Contact:

Re: Construction of Word Clock v1

Post by trax »

Zdravo,

Ne znam sta si dobio kombinovanjem ta dva fajla :-)

Ja kada ukljucim svoj sat i kod mene sve diode bljesnu kratko i ugase se. Nakon toga krene animacija i nakon nje se prikaze vrijeme. Takodje ne znam sta si radio sa Arduinom, jer ovo nema veze sa Arduinom...

Gledam evo shemu nekoliko puta i ne znam gdje ti je taj R4?
logr
Posts: 12
Joined: 23-02-2017, 13:14

Re: Construction of Word Clock v1

Post by logr »

LED_matrix_schematics_CADSOFT_Eagle.zip na toj shemi nalazi se R4. Koliko sam shvatio on određuje koji napon i snaga ide na LEDice. moje su max 20mA i 3.5V.
Šta se tiče arduina na netu sam našao kod za matrix 8x8 sa max7219.npr. http://tronixstuff.com/2013/10/11/tutor ... driver-ic/
Mislim da sam definitivno zeznuo sa samim programiranjem i flashanjem u oba slučaja i vjerujem da imam kratki spoj na matrixu. Čekam novi multimetar jer moj je dječja igračka i nepokazuje mi ni približnu točnu vrijednost.
Moje su isto samo zabljesnule kod startanja ali poslije se ništa nije dogodilo.
Zanima me još koja zener dioda ZD1 od 5.1 V mora biti u wattima na wc1 main pcb. Meni je 5.1V 0.5w.
Image slika matrixa i main PCB.
Post Reply