2015-04-30

3D 8x8x8 LED kubas

Atpigus puslaidininkiams gaminiams LED apšvietimas vis labiau užkariauja įvairias sritis. Kalbant apie jas siūlau pasižvalgyti po šviesų arba LED kubų pasaulį. Elektronikos entuziastų gaminami LED kubai - ne tik gražus vaizdas ir šviesų šou, bet ir sumanus technologinis iššūkis-projektas. Tiesa, dabar sukonstruoti savo kubą ypač paprasta kaip niekad - parduodami jų pusfabrikačiai. Kaip tik vienas toks ir man pakliuvo į rankas. Ką iš jo pagaminau ir kaip man sekėsi jį modifikuoti - skaitykite toliau šiame straipsnyje.





I. Intro

Pradžiai priminsiu, kad LED kubas - tai daug LED diodų turinti elektrinė schema, kur diodai vienas su kitu išdėlioti/sujungti į kubo formos gardelę. Toks kubas akivaizdžiai naudojamas įvairiems šviesos efektams generuoti bei yra daugiau šou priemonė nei realus praktinis daiktas.  Tokią schemą, žinoma, nėra labai sudėtinga pagaminti, tačiau sugalvojus tai padaryti pats projektas iškelia gan įdomių techninių reikalavimų ir problemų. Apie jas manau verta šiek tiek pakalbėti - bet vėliau. Kitas dalykas - kaip ir minėjau įžangoje, jeigu kubo projektavimo procesas netraukia, tai galima nusipirkti jau paruoštų LED kubo rinkinių (pvz. iš ebay). Tokį vieną gavau ir aš - LightSquared 8x8x8 LED cube DIY kit (aka. 3d8s ideasoft). Rinkinys skirtas paprastam 512 LED lempučių kubui pasigaminti, visos detalės jau pateiktos (žr. foto žemiau) - telieka tik teisingai sulituoti. Pradedančiajam elektronikoje ar siekiančiam pagerinti litavimo (kantrybės, kruopštumo irgi!) įgūdžius tai - puikus rinkinys. Mane labiausiai sudomino programavimo/valdymo galimybės ir kubo veikimo principai. Apie juos, surinkimą ir valdymą būtent ir pakalbėsime toliau.


II. Surinkimas

Iš pirmo žvilgsnio surinkti LED kubą atrodo niekai, bet net ir tokį paruoštą rinkinį užtruksime - visą dieną. Pirmiausia, kaip ir visi kinų gaminiai - jis neturi normalios dokumentacijos, anglų kalba labai laužyta/nerišli. Jeigu prie rinkinio negaunate parsisiųsti vartotojo vadovo, valdymo kodo - tai jo tenka ieškoti per visą internetą. Ne visi pardavėjai jį pateikia. Kaip ten bebūtų, susiradus vartotojo vadovą (su nuotraukomis!) ir pažingsniui atliekant nurodymus galima teisingai sulituoti kubą iš pirmo karto. Jeigu schemą sulituoti užtrunka porą valandų, tai likusi diena - bus paaukota 512 LED lempučių kojelių lankstymui ir litavimui. Gan nuobodus ir monotoniškas darbas - tačiau pabaigoje atperkantis kančias. Taigi schemą sulitavau gan greitai, o su lemputėmis teko ilgiau pasiterlioti.

Rinkinyje LED diodų duodama daugiau - mano atveju buvo 559 vienetai. Renkant ar prieš surinkimą būtina patikrinti, ar visi šviečia-veikia. Taip pat duodamas ir vienas papildomas poslinkio registras (shift register), jeigu netyčia būtų sugadintas. Iš visos didelės LED krūvos švietė visi, tačiau vienas turėjo sukeistas kojeles (anodą ir katodą), registrai veikė be problemų.

LED kubas sudarytas iš 8 x 64 lempučių sluoksnių, kuriuos reikia lituoti vieną po kito bei sujungti tarpusavyje. Iš papildomų lempučių kojelių sulitavau ilgas vielutes ir prijungiau kiekvienam sluoksniui atitinkamą neigiamą kontaktą. 8 lempučių sienos ilgis pasirinktas neatsitiktinai - tai puikiai atitinka vieną baitą mikrovaldiklio atmintyje arba vieną LED eilutę (būsenų on/off masyvą). Prisiuosčius kanifolijos ir lydmetalio kvapo bei viską sujungus gauname galutinį rezultatą, kurio kreivumas atvirkščiai proporcingas įdėtai kantrybei darbo metu. Mano galutinis rezultatas žemiau.


III. Efektai

Atėjus lemiamam momentui, paduodame maitinimą ir paspaudžiame įjungimo mygtuką - kubas sužimba visu gražumu. Maitinamas jis per USB jungtį - tam rinkinyje įdėtas USB laidas, kurio daugiau nei energijos tiekimui neina panaudoti. Duotame mikrovaldiklyje jau įrašytas kodas su nemažu kiekiu animacijų/efektų. Kol visi efektai pradeda kartotis turi praeiti apie 5 minutės. Tamsoje vaizdas žymiai įspūdingesnis. Kaip viskas atrodo - žiūrėkite žemiau esantį video.





IV. Dar galima?

Pasidžiaugus pagamintu daiktu ir beveik išmokus animacijas atmintinai - pradedama galvoti, kur dėtį kubą, nes pats įdomumas ir buvo - surinkimas ir gal pora valandų besidžiaugiant reginiu. Toliau, aišku,  atsibosta - galima drėbti į kampą, išlituoti arba bandyti įdėti dar animacijų/patiems suprogramuoti animacijas. Pasirinkus paskutinįjį variantą (sunkiausią), tenka informacijos ieškoti apie kubą internete. Tačiau prisiminus kinų gaminius, iškart vėl susiduriame su informacijos stygiumi. Net jeigu ir randame kažkokių užuominų apie kubą, tai - arba pagalbos prašymai padėti programuoti kubą, arba įvairūs aprašymai kinų hieroglifais, kuriuos tenka versti į anglų kalbą. Nors kubas parduodamas masinei rinkai, bet informacijos kaip programuoti jį ar valdyti - labai mažai. Kitas keblus dalykas - kinų panaudotas mikrovaldiklis STC12C5A60S2, kurį irgi pradžioje neaišku, kaip programuoti. Jis pasirinktas greičiausiai dėl to, kad yra pigus ir populiarus Kinijoje. Pakeisti jį kokiu kitu (pvz. Atmega16/32) sudėtinga, nes neatitinka išvadų reikšmės. Tad belieka aiškintis apie jį daugiau.

 

Žinoma, kas ieško - tas randa. Pasirodo, šis mikrovaldiklis yra senos ir labiai populiarios 8051 mikrovaldiklių šeimos palikuonis. Jaučiantiems nostalgiją ar dirbusiems su ja - viskas galbūt aiškiau. Programuojamas jis dažniausiai su Keil uVision programiniu paketu/įrankiais (naudojamas C51 kompiliatorius), o mašininis kodas (hex) įrašomas į STC mikrovaldiklį naudojant STC-ISP programinę įrangą per nuosekliąją (serial/uart) jungtį. Taip, šis STC mikrovaldiklis turi savyje iš gamyklos įrašytą startavimo programą (bootloader'į) per kurį jis yra perprogramuojamas (flash'inamas). Kadangi perprogramavimas vyksta per UART/serial jungtį, tai nereikia kažkokių ypatingų programatorių, kaip pavyzdžiui Atmega serijos valdikliams, užtenka ir įprasto USB-2-TTL moduliuko. STC12C5A60S2 galėtume pavadinti savotišku kinų Arduino. Standartinį kodą, kuris būna įrašytas į jį galima rasti pas pardavėjus ar klaidžiojant internete. Tad belieka užkurti paminėtus įrankius ir pasižiūrėti, ką galima padaryti su šiuo kubu.

V. Programavimas

Norint programuoti STC12C5A60S2 pirmiausia reikia pasimodifikuoti plokštę - prisilituoti jungtis prie neužimtų VCC, GND, P30, P31 išvadų (žr. foto žemiau). Tai standartinės nuoseklios (serial/UART) sąsajos išvadai. Čia P30 atitinka RXD, o P31 atitinka TXD. Po to galime jungtį prie kokio nors kompiuterinio USB-2-TTL konverterio/modulo (rasti galima ebay ir pan.). Primenu, kad laidus reikia jungti sukryžiuotai: PC RXD < > STC TXD bei PC TXD < > STC RXD.

Esant sėkmingam ryšiui su mikrovaldikliu galima pabandyti perprogramuoti jį. Patikrinimui ir perprogramavimui naudojame STC-ISP programą. Ją atsidarius turime pasirinkti mikrovaldiklio tipą, teisingą COM jungtį, paspausti mygtuką "Check MCU" bei išjungti ir vėl įjungti LED kubo maitinimą. Tuomet įjungimo metu nuskaitoma informaciją iš valdiklio. Tai atlikus ekrane matysime pavaizduotus užrašus - versiją, valdiklio veikimo dažnį ir t.t.


Praėjus ankstesnį etapą, galima bandyti ir perprogramuoti. Pradžiai siūlau pasirinkti originalaus sukompiliuoto mašininio kodo failą (hex) su mygtuku "Open Code File" ir po to spaudžiant "Download/Program" pradėti operaciją. STC-ISP programai pasirengus išjungiame ir vėl įjungiame kubo maitinimą. Po įjungimo prasidės perprogramavimas. Jeigu viskas sėkmingai įvyks - tai kubo veikime jokių pokyčių nepastebėsime, tiesiog programa bus perrašyta naujai.


Keilu uVision nemokama versija turi savo trūkumų - negalima sukompiliuoti programos, kuri užima daugiau nei 2KB flash atminties ir t.t. Taigi originalaus LED kubo kodo sukompiliuoti bus neįmanoma, nes jis per daug užima. Žinoma, galima susirasti interneto platybėse ir pilną Keil versiją, tačiau yra kita galimybė - valdyti kubą per nuosekliąją jungtį tiesiai iš kompiuterio ar su kitu mikrovaldikliu (pvz. atmega). Aišku, kad taip būtų galima daryti, reikia pirmiausia suprogramuoti tai leidžiančią STC programą. Per daug nesivarginus, tokį kodą (firmware v2), kuris lengvai kompiliuojasi su Keil uVision, jau parašiau ir jį rasite [čia], kartu su kitais prie kubo gamintojo pateiktais failais. Įdėjau ir mašininio kodo .hex failą, tad net kompiliuoti nereiks. Tereikia įrašyti į mikrovaldiklį anksčiau nagrinėtu būdu. Norintiems savarankiškai paprogramuoti su Keil - visada prašom, tam pateiktas Keil projekto failas.

VI. Valdymas iš PC


Naujoji STC mikrovaldiklio programa (firmware v2) leidžia kubo LED lemputes valdyti per serial/UART jungtį, t.y. animuoti. Animacijų generavimo palengvinimui pasaulyje jau prikurta daugybė programų, kurias galime rasti internete. Kinas aGuegu sukūrė paprastą valdymo protokolą ir programą 8x8x8 kubo valdymui. Šiek tiek ją modifikavau ir patobulintą variantą rasite [čia], t.y. tinkantį mūsų atvejui (kubo valdymui per UART). Programa palaiko animacijų redagavimą, grojimą ir t.t. Be abejo, išsaugojus animaciją .dat formatu į uSD kortelę bei iš jos skaitant, galima valdyti kubą kitu mikrovaldikliu (pvz. atmega/arduino [kodas] ar pan.), kuris prijungtas prie UART jungties. Kaip veikia programa ir kaip sukurti animacijas žiūrėkite žemiau esančiame video.



VII. Techniniai dalykai

Dar šiek tiek informacijos apie patį kubą, jo valdymą - technines detales. Ankstesniame skyriuje minėjau, jog verta pakalbėti apie kubo projekto ypatybes, reikalavimus ir problemas. Taigi, pradėkime nuo paprastesnių dalykų. Vienas iš jų - energijos tiekimo užtikrinimas. Kubui įtampa tiekiama iš USB lizdo, tad maksimali galia, kurią galime paimti yra apie 5V * 500mA = 2.5W. Jeigu vieno LED naudojama srovė ~5mA, tai geriausiu atveju galime vienu metu maksimaliu ryškumu įžiebti 500mA/5mA = 100 LED lempučių. Kube turime 5x daugiau - taigi, kaip gi įmanoma įžiebti visą kubą su 2.5W? Atsakymas slypi kubo sudalinime į sluoksnius. Užtikrinama sąlyga - vienu metu dega tik vieno sluoksnio lemputės. Atsiminkime, sluoksnis sudarytas iš 8x8=64 lempučių, taigi čia jau arčiau tos ribos, kurias galime įžiebti. Dabar jeigu sluoksnius įjungiame vieną po kito ir darome tai taip greitai (perjunginėjame), jog žmogaus akis nepastebi - turime įspūdį, jog dega viso kubo visos lemputės vienu metu. Super triukas! 

Kitas, ne ką mažiau įdomus dalykas kubo projektavime - išvadų skaičius. Kaip valdyti 512 lempučių su ribotu skaičiumi (t.y. < 44) mikrovaldiklio išvadų? Atsakymas - pasitelkti poslinkio registrus (pvz. 74HC573). Toks registras valdomas 2 išvadais, o išėjimų skaičius - 16. Išėjimų skaičius gerokai padaugėja. Registrus galima jungti į kaskadas. Tačiau to vis tiek nepakanka net gi su 8 registrais (nes 8x16=128). Todėl dar naudojamas specialus sujungimo metodas vadinamas Charlieplexing, kuris leidžia valdyti maksimalų objektų(lempučių) skaičių su turimais išvadais.

Viso kubo lempučių būsenų (on/off) informaciją galime sutalpinti į 64 baitus, t.y. 8x8x8 bitus, iš čia ir kubo pavadinimas. Kubui valdyti pakanka paduoti šią informaciją. Per serial/uart jungtį reikia siųsti gana paprasto formato duomenų paketą (kaip pateikta žemiau). Siuntimo UART parametrai: baud - 9600 bps, 1 stop bitas, be lygiškumo (no parity) bito.


unsigned char frame[65] = {
    0xF2,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF
};

Pakete 0xF2 baitas nusako, kad toliau prasideda pilna kubo informacija (animacijos kadras). Likę 64 baitai apibrėžia visų kubo lempučių būseną. Kiekviena paketo eilutė nusako vieno sluoksnio būseną, o eilutėje esantys baitai - sluoksnio eilučių būseną. Galimos baitų reikšmės 0x00 - 0xFF diapazone, kur 0x00 - sluoksnio vienos eilutės visos 8 lemputės išjungtos, o 0xFF - sluoksnio vienos eilutės visos 8 lemputės įjungtos. Pavyzdiniame pakete kiekvieno sluoksnio pirmųjų eilučių lemputės įjungtos (0xFF reikšmė). Siunčiant tokius paketus bent  ~30 kadrų/s (t.y. kas ~33ms) užtikrinsime sklandžią animaciją.

VIII. Reziumė

Taigi išnarplioti šį kinų gamybos LED kubą nebuvo lengva, o ypač suprogramuoti STC mikrovaldikliui efektyvią programą darbui su UART. Jeigu to nesiimame, tai tik sulituoti kubą nėra labai sudėtinga. Visa informacija apie kubą, programą galite rasti Github'e. Tikiuosi, kad pritaikysite pateiktas žinias ir savo darbams. Sėkmės ir iki kito karto!

LED Cube source - Github
Cube control program source - Github

55 komentarai:

  1. isigijau ir surinkau ir as toki kuba. tik deja normaliai neveikia. isemus sluoskniu valdymo mikroschema uln2803 nera skirtumo ar ji yra ar ne. pakeiciau kita, rezultatas nepasikeite. kame gali but problema?

    AtsakytiPanaikinti
    Atsakymai
    1. Reiškia ULN2803 niekuo dėtas, problema - kitur.
      Pirmiausia reikia pasitikrinti, ar tikrai viskas sulituota teisingai, ar mikroschemos neįdėtos apsuktos, ar teisingai prilituotas A09-103 rezistorius, ar neužtrumpinti kontaktai, gal koks reikalingas liko neprilituotas? Taip pat pasitikrinti, ar sluoksniai teisingai sujungti (žr.foto), ar gerai paduodamas GND'as sluoksniams.

      Galiausiai nieko neradus - teiktų pradėt žiūrėt sujungimo schemą.

      Panaikinti
  2. Surinkau RGB led kuba pagal sias instrukcijas http://www.kevindarrah.com/?cat=99. Programavime esu zalias. Noriu padaryti kad kubas veikt usu atmega32 valdikliu, ir pajungus prie PC butu galima su kokia programa generuoti animacijas.
    Kal turi minciu ar gali pagelbet ? :)
    Dekui

    AtsakytiPanaikinti
    Atsakymai
    1. Tada vertėtų nuo paprastesnių dalykų pradėti - suprogramuot mirksiuką (LED degiojimą), išmokti, kaip dirbti su UART ir pan.
      Viską įmanoma padaryti, tačiau praverstų daugiau patirties. Valdymo kodo nedaug, išskyrus darbą su pačiu UART'u.

      Panaikinti
  3. Sveikas
    Rasai: "Be abejo, išsaugojus animaciją .dat formatu į uSD kortelę bei iš jos skaitant, galima valdyti kubą kitu mikrovaldikliu (pvz. atmega/arduino [kodas] ar pan.), kuris prijungtas prie UART jungties". Kaip suprantu arduino su kodu ir sd korteliu skaitytuvu jungiu prie atmega32 Tx Rx pinu? Ar klystu?
    Ar gali nukreipt kur apie tai daugiau pasiskaityt.
    Padariau led kuba vadovaudamasis siomis instrukcijomis http://www.instructables.com/id/Led-Cube-8x8x8/#step1.
    Per UART jungti su tavo pasiulyta programa animacijas atkuria netiksliai, ar gali buti kad si programa netinkama Atmega32 kontroleriui.
    Is karto dekoju uz pagalba :)

    AtsakytiPanaikinti
    Atsakymai
    1. Ne, Arduino/Atmega su uSD kortele jungi prie STC mikrovaldiklio (koks yra originaliame LED kube).
      Jeigu nori kubą valdyti su Atmega32, tai reikia perrašyt UART komunikavimo dalį. Firmware v2 skirtas tik STC mikrovaldikliui. Animacijos grojimo iš uSD kortelės kodas galbūt ir tinka Atmega32, nebandžiau.

      Panaikinti
  4. Tai as tai ir turejau omenyje. Tik man neaisku kaip pajunti arduino prie STC mikrovaldiklio (kurie pinai ir pan). Gal kokia schemute turit?

    AtsakytiPanaikinti
    Atsakymai
    1. Viskas parodyta "V. Programavimas" skyriuje, yra netgi foto. Arduino turi UART išvadus, tad siūlau pasidomėti jų paskirtim ir kaip juos sujungti.

      Panaikinti
  5. Atmega328 2pin(RXD) --> STC (TXD), Atmega328 3pin(TXD) --> STC (RXD), tas pats kas jungti prie PC, tik cia kompo vaidmeni atliks ir animacijas leis Arduino? SD readeris prie Arduino VCC, GND ir CS.
    Tikiuosi gerai viska supratau :)
    Dekui uz pagalba

    AtsakytiPanaikinti
  6. Sveikas, norėčiau su tavim susisiekti asmeniškai, kaip tai galėčiau padaryt ? :)

    AtsakytiPanaikinti
    Atsakymai
    1. Gali rašyti per Google+ arba į el. paštą: tomas.uktveris [slyva] gmail.com

      Panaikinti
  7. does not detect the STC....
    you know how to help me ?
    thanks

    AtsakytiPanaikinti
    Atsakymai
    1. Nope, have no clue. There's a mistake somewhere (as always), so doublecheck.

      Panaikinti
  8. Thanks for Your work on this :)
    Do you know any way to convert the 3D8 .dat files to hex files in any way?
    Would be nice to not have to be connected to PC and arduino all the time :)
    Thanks again

    AtsakytiPanaikinti
    Atsakymai
    1. Hi, no there's no way from hex to c code. You can always connect to arduino that's reading the animations from microSD card and sending them via serial.

      Panaikinti
  9. Hey, i’m a newbie in electronics and i just built this led cube
    Now i’d like to add more animations but your tutorial is a bit high level for me :)
    Is it possible to make a simple summary of what to use/buy (usb2ttl i guess), how to connect the cube to the pc and what to do on the pc (what to download, where to press and that’s it :p).
    I just wanna know what to do, not how it works :)
    Thank you, you did a really great job with that cube ;)

    AtsakytiPanaikinti
    Atsakymai
    1. Hi, you already found out what you need. Buy the usb 2 ttl tool from ebay or some electronics shop ahd your'e good to go. Everything's already covered with screenshots.

      Panaikinti
  10. Hey,
    I have one Question to you. maybe you can help.
    I allready flashed my STC_Controller sucessfully,
    and the cube shows me the (sand clock) like in the video!
    But now I want to Start the software:
    When I klick on connect to COM_Port they connect.
    When I Klick to one LED the Animation (moving LEDs) stops.
    Now the cube is hanging in this possitions,
    but when I change a lot of LEDs in the software they change...
    But there are not the same LEDs like in the Programm.

    How can I get the live Update of the LEDs?

    Please help me.
    Thanks for the answer

    AtsakytiPanaikinti
    Atsakymai
    1. Hi, ensure "Loop animation" is checked before pressing start. Also, add more than one animation frame. That's it.

      Panaikinti
    2. Looks to me the PC side and TTL converter is working great. The problem mostly is with the cube. Check if your RXD/TXD wires are connected correctly & not exchanged - and also, there could be some hardware difference, also it could be a bug in the firmware v2 or some mistake in the cube itself (hardware). It's up to you to find out.

      Answer to:
      Thanks for your Answer,
      but I have Loop Animation checked!
      I used the 3D8S.exe Alpha or dontmatrixjava.jar.
      But when I connect COM my Cube do nothing,
      when I load an example the Cube is freezing.
      My TTL Converter is blinking very fast,
      but the Cube do nothing...
      Where could be my Problem ?!
      I flashed the STC with the v2 8x8x8.hex!
      Thanks again for answering ;)

      Panaikinti
    3. Also check your TTL parameters: baud, parity & stop bits, should be 9600,none,1 respectively.

      Panaikinti
  11. STS-ISP programa ismeta klaida nors softas naujausias. Ju puslapyje naujausia versija 6.85. Kame gali buti reikalas?

    Re-handshaking ... Successful [0.579"]
    Current Baudrate: 57600
    Erasing MCU flash ...
    Download failed ! (6.85Q)(2017-02-07 00:22:26)
    Please using the newest software !

    AtsakytiPanaikinti
  12. gal yra kokia kiotkia programa siu valdikliu programavimui?
    Dekui

    AtsakytiPanaikinti
    Atsakymai
    1. Kiek žinau nėra, čia oficialus gamintojo įrankis, tad tikresnio nebus. Galima ieškoti 8051 įrankių internete, bet vargu ar jie veiks su kinų valdikliais.

      Tikrinčiau pirmiausia ar viskas su geležim teisingai prieš kaltinant STC-ISP programą. Blogas gali būti netgi UART modulis nesugebantis patikimai dirbti didesniais greičiais arba ilgi laidai, etc.

      Panaikinti
  13. I have one of this cube's also, but mine comes with an STC15F2K32S2.
    Is the cube source for this STC anywhere? Or this also works for this chip?

    AtsakytiPanaikinti
    Atsakymai
    1. The STC15F2K32S2 is pin incompatible however the UART/timer initialization code looks like the same. There might be a possibility that it would work if you try.

      Panaikinti
  14. But if it uses other pins will not drive correctly the led's, no?
    From this link you can see that the cube I have is the same in looks, even the PCB is the same but with less components since the STC15F2K32S2 drives the led's directly:
    https://mysku.me/blog/ebay/53178.html (it's in Russian, but chrome and google translates it)

    AtsakytiPanaikinti
    Atsakymai
    1. Since it drives the LEDs directly, then the code here will not work for STC15F2K32S2.
      From the article it looks like you don't need to program the STC15F2K32S2 directly. It already has the code/commands to be controlled externally via UART (e.g. Arduino). See Section 3 of the link you provided.

      Panaikinti
  15. Yes I have all that working, I just want to strip the internal animations since my project is for displaying scrolling text and if UART fails or gets some timeouts the internal animations jump start.
    I want the code inside the STC only with the UART function and nothing else since all my code is done with Arduino, actually I'm using and ESP8266 since I have internet data auto update and so on. ;)

    AtsakytiPanaikinti
  16. Hi I have the programmer work and its great. In the record menu, what does Mode mean? Is this something to do with the unpopulated S2 and S3 switches on the board?

    AtsakytiPanaikinti
    Atsakymai
    1. Record->Mode/Brightness/Span is ignored(not used) in cube v2 source code.
      In initial source Mode meant cube axis configuration: XYZ(0), YZX(1), ZXY(0). The default was XYZ(0).

      The S2 and S3 in schematic https://github.com/tomazas/ledcube8x8x8/blob/master/schematics/schematic.pdf are connected to INT1 and INT0 respectively that do nothing in code. Maybe the switches were used for debugging during initial cube programming.

      Panaikinti
  17. Hi will this bake these animations into the cube so it will run off an power source?

    AtsakytiPanaikinti
    Atsakymai
    1. No, it will not store animations inside the cube (or mcu). Something needs to control(send) the animations to the cube. You can do this via PC module (as showed in this article) or connect Arduino & SD card to the cube. Google "arduino sd card serial data transfer" for this.

      Panaikinti
    2. Thanks for the quick reply. Loving the software.

      Panaikinti
  18. Is there anyway of combining more than one of the example files into one big animation so the cube will cycle through different animations?

    AtsakytiPanaikinti
    Atsakymai
    1. I think it would be possible. You would need to parse all those animation files, extract all animation frames and write the merged contents back into a single big animation file.

      Panaikinti
  19. Thanks for the great article/write-up. I have the icubesmart 8x8x8. It also uses the STC12C5A60S2, but uses the LQFP-44 pin-out. Is it possible to modify the code for this to work?

    AtsakytiPanaikinti
    Atsakymai
    1. Should be possible since the MCUs are type-identical. Given enough time and testing materials this is left as an exercise for the reader.

      Panaikinti
  20. Hey Tomas!
    I have a bit of a problem here, could you please help me?
    I have purchased the board from eBay, but apparently it is somehow different from the board that you suggest to use. I have flashed it per your instructions and it doesn't work anymore. 2/3 of LEDs are always ON and nothing happens. Re-flashing didn't help and I (of course) do not have original firmware.

    Do you think you can help me here?
    Here is the link for the board: https://www.ebay.com/itm/202273476179

    Thank you very much!!

    AtsakytiPanaikinti
    Atsakymai
    1. The board connections are probably different, so the current firmware will not work (as you already found out). Surely the code can be adapted somehow, but I don't have the resources to do it and test it. So this is up to you.

      Panaikinti
  21. Hi Tomas!
    I do not speak Lithuanian, but this is the most helpful guide to working with an 8x8x8 cube I have found. (Google translate helped out a lot too) Mine is now working exactly as you described, now all I need to do is figure out how to make custom patterns work in stand alone mode. (Mine reverts to it's original pattern once I disconnect it) Best regards, Norman Morse

    AtsakytiPanaikinti
    Atsakymai
    1. I'm glad it helped you. The best option would be to connect an Arduino that reads animations from SD card.

      Panaikinti
    2. I see that Keil has a very limited code size, (unless you have thousands of dollars to spend on a licence) Other than making a "hello world" type program, learning to use it strikes me as pointless, unless you intend to eventually work for a rich software company that can afford to use it. SDCC might be the only viable option, to get the job done. A bit clunky, ("syntax error" is the only clue it gives you about what is wrong)but a lot better than assembler. I ran the hex file through Edsim51, and can see what is going on, but manipulating large code there is too complex for the average hobbyist to follow I think. Is it OK with you if I edit your stuff? I will obviously leave your copyright stuff in, so people know it's your original work.

      Panaikinti
  22. Thanks for the prompt reply! Yes, an Arduino and SD card would be quicker, but then you would have additional components and a less elegant solution. If it was possible to learn how to manipulate the STC chip fully, it would help most of the people in a similar situation, and allow this project to be further developed. Scrolling text displays, that sort of thing. My problem is that until a few days ago, I was unaware of the existence of this device, so my learning curve is both steep and high. That does not put me off at all, so I will go this route. Can I ask how the ledcube8.hex file was originated? I will go looking for any info I can gather about the chip and it's architecture, if I find anything useful where would be best to post my findings?

    AtsakytiPanaikinti
    Atsakymai
    1. You need to compile C code to obtain the machine code ledcube8.hex file (I won't get into details how to do this, Google it). Required information is already written in project Github.

      The best is to make a personal blog page yourself and post all findings there.

      Panaikinti
  23. Hi. Excuse my bad English, I speak Spanish. If you speak Spanish I can write in it.



    I was looking for sources about a DIY Cube kit that incorporates a MICROSD module, speakers in which MP3 music can be placed.
    https://articulo.mercadolibre.com.co/MCO-486418175-kit-cubo-led-8x8x8-multicolor-con-musica-mp3-control-remoto-_JM

    The question is, I wanted to program my own animation sequences. I have been searching and found this website where the documentation comes from.
    http://www.zirrfa.com/index.php?route=product/product&product_id=76


    There I see cubes that do not have the MicroSD module to play Mp3 music, but I saw that there were references about your 3D8 TF Animation Editor program, although I could not see anything in the audio module kit.

    I was wondering if this audio module kit is also compatible with your program ?, and if using it can deprogram or alter the operation of the extra modules.

    AtsakytiPanaikinti
    Atsakymai
    1. Software and animation program does not support microSD/audio/mp3 playback or extra modules.

      Your cube has a different chip STC15F2K60S2, which is not compatible with STC12C5A60S2.
      You can try but success is not guaranteed.

      Panaikinti
    2. Autorius pašalino šį komentarą.

      Panaikinti
    3. Hi. Thanks for your quick answer. Actually, the one I bought is the one from the first store (MercadoLibre). In the documentation is the kit "ZF-SIRAMP-M8".

      Some websites show your software, others not if I look for it with that name of the kit. Maybe it's because they use different MCUs, like the one you mention. Although I was wondering if USB-TTL is necessary and could I do it directly with Arduino.

      In the documentation they only share one animation method, but it is complicated for me since I do not fully understand the code that it uses to turn the LEDs on and off. I would like to leave you a link on the documentation and the .ino code with some animations.

      https://drive.google.com/drive/folders/0B5FDcRwkbQ5Bb2tHYnpiQ1d5VkE?usp=sharing

      If there is a way to use your software it would be great.

      Panaikinti
  24. Hello, I have an error in your program. I don't know if it's because I don't have the module connected or I have misconfigured the variables. If it is the latter case, what would be the correct configuration?
    https://ibb.co/kSzy8Dq

    AtsakytiPanaikinti
    Atsakymai
    1. Run via run_x32.bat or run_x64.bat, not by running the dotmatrixjava.jar directly.

      Panaikinti
  25. Hi. I found this page about an Arduino library on these cubes.

    https://majicdesigns.github.io/MD_Cubo/page_z_i_f_f_r_a_d_i_y4x4x4.html

    It says it is compatible with the MCU of my DIY Kit. Although I was testing the samples, none got to work, only one managed to maintain communication with Arduino through the Serial Port, even though I looked at the code and did not find the Serial.write (0xAD) command; but I didn't see it anywhere, so it seemed strange to me that the cube reacted.

    AtsakytiPanaikinti
    Atsakymai
    1. Hi Iman, I may be of some help here. The cube Tomas has is the same as the original one I have, and his stuff works well with it. However, the cube you have seems similar (mostly) to the second cube I bought, with a music facility, wifi and bluetooth, and can play a radio station, and has a memory card facility. Now although they use the same chip, they are completely different animals. Both sets of software have no real similarities. This is the second one I have, you can see it must be made by the same people as yours, the speaker is identical, the layout differs slightly, the LEDs are common anode rather than common cathode, etc.

      https://www.banggood.com/Upgraded-Version-3D-Light-Cube-Kit-8x8x8-Blue-LED-MP3-Music-Spectrum-DIY-Electronic-Kit-p-1394537.
      html?rmmds=detail-left-hotproducts__2&cur_warehouse=UK

      Use a text editor on the file shuju.h and you can see the lookup table, that generates the various patterns. Once you run the Keil software to assemble it into a hex file for uploading to the cube, the hex file contains this information, in a "difficult to understand" format. Another problem is that a licence for Keil is thousands of dollars, and it won't compile large programs on the free version. The Chinese chaps don't really care, they just crack the program and Keil cannot do diddly squat about it, they cannot enforce their copyright on Chinese people like they can in the west. But if you understand the 'C' programming language, you can use a free compiler and assembler (after making the required changes) to do that. IF not, just change the hex file manually to alter some of the patterns. For example, If I "Find" the phrase D1AA84EA3F28E402 (the Chinese character meaning 'change')and substitute it with 003C424242423C00 in the hex file and upload it to the cube, it will display the letter "O" instead of the Chinese character. For more complex manipulation, you need to go the compiler route, as some of the displays are lookup tables, other ones are shift functions, others are a single pattern that the software rotates. I am in the process of understanding the whole program, and changing it to my own requirements. If I have any luck I will publish my findings for others.

      Panaikinti