Author Topic: [XMAS_2013] Christmas spirit  (Read 12436 times)

0 Members and 1 Guest are viewing this topic.

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
[XMAS_2013] Christmas spirit
« on: December 09, 2013 »
hey guys here is my little entry for the christmas challenge.

it was really a toss up between doing a little electronics project or using my glsl engine ive been coding all year. i could have taken the easy route and done a gfx demo but after doing hundreds of hours on the engine i needed a little break.

so here is what i came up with.

www.youtube.com/embed/t8W3jLAzXpk

it was built around the same idea as the little demo i posted earlier in the summer but expanded too push the arduino too its limits. the whole electronics side is made up from 9 led driver chips daisy chained in groups of 3 with each driver chip connected too its own led matrix of which there are nine.

all chips share the same common vcc and ground power rail using a voltage regulator.

each group of max led drivers is connected too digital pins on the micro controller.

there are three wires too each driver chip a clock wire a dataio wire and finally load. and basically you poll these three lines sending data and quickly pulling the arduino pins low then high which in turn lights the required leds.

on the software side i had no idea if driving this from one small micro controller would be possible but i was pleasantly surprised. i started with a complete blank canvas just a few max register defines really.

first i build low level drivers which maps a 25,4 byte back buffer too the whole display treating it as one. my map function sends the back buffer as blocks too the correct max led driver chip. so from the front end you treat it like tinyptc with renderpoint(x,y) but the back end had too be coded very cleverly.this all had too be done as lightweight as possible too make effects possible.

i will when i get more time do a full postmortem and share a little further how the hardware goes together and exactly what components were used and how much.

the whole program takes up 18kilobytes of memory on the micro controller and the code is separated with large items being put in PROGMEM area of ram and the rest going into the normal area.

attached is source have fun guys.
« Last Edit: December 08, 2014 by ninogenio »
Challenge Trophies Won:

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #1 on: December 09, 2013 »
love it!  :clap:


i may make a sneaky entry, i tried to get what i've bene working on in my gl lib fixed up so i can make something but i failed fixing it yesterday :(   (i've got render to texture in, but having issues rendering it to a quad from there, and i want to use that part of my lib to do my entry)

(and cheers for the shoutout!)
« Last Edit: December 09, 2013 by Canopy »

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #2 on: December 09, 2013 »
cheers mate! i really enjoyed doing this for a little relaxation,

its took about 2 weeks.. 3 or 4 hours a night. one thing i did find is that by simply wiring everything in a sensible order you can save thousands of cycles on the code side when mapping the backbuffer too the led driver chips.

@ the render too texture,

i remember when i had some serious issues implementing that very feature into my apophis library it all came from necessity, while i was coding the volumetric fog and shadow mapping. and every time i try'd too render too quad i would just get a black texture. i am sure it turned out too be something simple like not resetting my texture units from a previous state. if there is anything i can help you with i would be glad too mate, i would love too see loads of entries coming in.
« Last Edit: December 09, 2013 by ninogenio »
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #3 on: December 09, 2013 »
That is Excellent  :clap:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #4 on: December 09, 2013 »
thank you hotshot!

forgot too say the ghosting of the text in the video does not happen irl its an artifact of my phones camera.. i have lent my hs 10 camera too a friend who is away on holiday as soon as he gets back ill upload a much better video.
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: [XMAS_2013] Christmas spirit
« Reply #5 on: December 09, 2013 »
Brilliant! You're clearly pushing the limits of your hardware and you've put a lot more time into this one than I will have out into mine when it's finished.

Bonus points for the 3D cube at such a low resolution too :o
You are our 9001st visitor.
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #6 on: December 09, 2013 »
thanks ck,

yeah its nine screens at 8x8 leds so 24x24 resolution. i kind of surprised myself as i added effect after effect and the hardware just kept going.
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: [XMAS_2013] Christmas spirit
« Reply #7 on: December 09, 2013 »
That's epic ninogenio! Really amazing stuff :) Loved the mixture of effects. Btw, can I hear chips frying in the background? ;)
raizor

Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #8 on: December 09, 2013 »
cheers mate!

haha.. i left the hot water for the dishes running. i was watching the sink slowly fill up thinking oh god please hurry up. just made it before history's second great flood lol.
Challenge Trophies Won:

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #9 on: December 09, 2013 »
i remember when i had some serious issues implementing that very feature into my apophis library it all came from necessity, while i was coding the volumetric fog and shadow mapping. and every time i try'd too render too quad i would just get a black texture. i am sure it turned out too be something simple like not resetting my texture units from a previous state. if there is anything i can help you with i would be glad too mate, i would love too see loads of entries coming in.
thanks, i'll take that on board i'm going over all that code now, trying to put in a quick 30 mins or so here n there, sometimes quick random stabs are better than hitting something with a hammer for hours on end :)

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: [XMAS_2013] Christmas spirit
« Reply #10 on: December 09, 2013 »
I'm also getting a "tinsel" vibe from the wires in the background. Very festive.  :xmas:
You are our 9001st visitor.
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #11 on: December 10, 2013 »
cheers guys! @ck ha i never noticed that till now  :kewl:

@canopy yeah spending tons of time on a problem all in one go can be counter productive. i find modern gl very very very sensitive too state changes not being fully restored 90% of my problems came from this. eventually i just started being over cautious and resetting things over and over again in the same frame. i have since not had many issues other than the time it takes too learn new things.

well as promised i will do a little postmortem of the thing starting with a list of all the components used. i am providing links too ebay for you guys. i cannot however vouch for the sellers these are only too show what would have too be bought and rough costs.


http://www.ebay.co.uk/itm/10PCS-MAX7219CWG-SOP24-IC-/150653001185?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item23139e5de1

max7219 led matrix driver chips = 13.99

http://www.ebay.co.uk/itm/40-Male-To-Female-Jumper-Breadboard-Wires-Arduino-20cm-/171190195768?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item27dbbb1638

led matrix wires of which i had too buy 4 packs= 2.99x4= 12

http://www.ebay.co.uk/itm/Breadboard-Jumper-Leads-130-Male-to-Male-Arduino-RaspberryPi-PIC-UK-New-/290914413942?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item43bbd9ad76

general breadboard connection leads = 6.10

http://www.ebay.co.uk/itm/SYB-500-4-In1-700-Position-Point-Tiepoint-PCB-Solderless-Bread-Board-Breadboard-/400521005591?pt=LH_DefaultDomain_3&var=&hash=item5d40e98a17

large breadboard = 13.99

http://www.ebay.co.uk/itm/ATMEGA-328-P-ARDUINO-Full-Breadboard-Components-KIT-UNO-PRE-LOADED-BOOTLOADER-/221188384212?pt=UK_BOI_Electrical_Components_Supplies_ET&var=&hash=item337fdae5d4

breadboard compatible atmega microcontroller with ttl usb = 6.85

http://www.ebay.co.uk/itm/10-pcs-LED-Dot-Matrix-Display-3mm-8x8-Red-Common-Cathode-32x32mm-/140767113687?pt=LH_DefaultDomain_0&hash=item20c65fb1d7

led matrix's = 9.85

http://www.ebay.co.uk/itm/Panasonic-Electrolytic-Capacitor-250v-10uF-25-Pcs-C23-/390259597391?pt=UK_BOI_Electrical_Components_Supplies_ET&hash=item5add48e04f

a bag of 10uf capacitors for the max driver chips = 4.50

so everything comes too a total of somewhere around 70 with postage. not exactly the cheapest project but worth every penny for fun and satisfaction. plus this gives a really really nice kit too make other projects.

the postman brought me my nice new arm cortex micro controller kit today so when i get round too it i should be able to supercharge this and possibly double the screen count giving a 48x48 res but this wont be for this challenge, just for fun  :)
« Last Edit: December 10, 2013 by ninogenio »
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: [XMAS_2013] Christmas spirit
« Reply #12 on: December 10, 2013 »
So even if you won, the prize money wouldn't cover the cost of the parts?

Still, if it was a complicated project which pushed the boundaries of your skill and knowledge, it was well worth it. And we've got one of the most novel and eye-catching contest entries ever.
You are our 9001st visitor.
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #13 on: December 11, 2013 »
thanks ck.

for me i already had 80% of the things at hand as i buy bits and bobs on a regular basis i only had too buy a few driver chips some wires and a 2 screens too make it all come together.

that list is just really for anyone intersted in making something similar.
Challenge Trophies Won:

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #14 on: December 12, 2013 »
@canopy yeah spending tons of time on a problem all in one go can be counter productive. i find modern gl very very very sensitive too state changes not being fully restored 90% of my problems came from this. eventually i just started being over cautious and resetting things over and over again in the same frame. i have since not had many issues other than the time it takes too learn new things.
ended up turning a quick 30 mins into all the evening last night.. been through all the states.. nothing seems a-miss really.. did fix one bug with VAO/VBO where i'd missed a re-binding to the VAO meaning the wrong buffers were updated with some geometry, however that only showed when adding my third layer to aid debugging in the first place.

i think its 'just' a bug on that one part. once i do find things, it'll be fixed in my render loop for all apps :)

my render loop processes my scene mgr list like so..

   - layer 1 that draws on the texture -> texture shows OK within gDEBugger & CodeXL and updates happen based on time ok
   - layer 2 that draws this texture on a quad on the real screen -> no errors, but nothing happens, not even a black rect like i've seen people on other sites report when having issues here
   - new layer 3 that draws a line across the real screen -> works fine (showing state+shaders are flipping between RTT+the real screen OK)

my next job is to use a texture from a different source in its place to tighten up as much of that side of things as poss (probably just a hard code lump of a single colour like 0x00 0xFF 0x00 in memory and use that)

anyways..

have you thought about recording another take of your demo again closer up + in the dark? "lights out edition"
« Last Edit: December 12, 2013 by Canopy »

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #15 on: December 12, 2013 »
it sounds like your really close!

if your texture is showing ok in gDEB and the updates are happening at the right time. the problem must either be coming from the second layer or somewhere in the crossover ( presumably layer 1 passes layer 2 the texture as soon as layer one is finished its processing? ).

its a little strange that you aren't even getting the dreaded black quad though?, it really sounds like one of those tiny little things that can happen where there isn't actually an error, i mean as you well know gl is very sensitive and even the order in which things are being done can greatly affect the outcome.

Quote
my next job is to use a texture from a different source in its place to tighten up as much of that side of things as poss (probably just a hard code lump of a single colour like 0x00 0xFF 0x00 in memory and use that)

sounds like a plan!
when i stumble into similar things i usually sit back and try too think of ways of visually debugging my app, and also clever ways too trace something through the rendering phase so that i can be 100% sure where things fall over. i sometimes strip everything back by block commenting huge chunks of my code out so that i start with an almost empty template(with just the basics that i know work left in) then slowly uncomment the code a peice at a time checking the results with gDEB this is the most brute force way but it has saved me more than a few times :).

Quote
have you thought about recording another take of your demo again closer up + in the dark? "lights out edition"
yeah as soon as i get my good camera back of my friend i will upload a much better video i tried with the lights out with my phone but there was far too much glare..

one thing i would love too try next is an rgb led matrix with full pwm control meaning you can dim each individual led by as much or little as you wish if i were too do this it would give me a full color spectrum so for each led you could have different rgb brightnesses represented just like we do in code ie 0-255.

but its a bit of a nightmare too do.. for this project each led 8x8 matrix only had 16 pins and one driver chip assigned too those pins, but for a full rgb 8x8 matrix i would be looking at 48 pins and if i wish too do pwm i can't group the pins in 16's too each driver chip. i would probably have too use a ton of TLC5940's

i am quite excited too begin a few experiments  :)
« Last Edit: December 12, 2013 by ninogenio »
Challenge Trophies Won:

Offline Canopy

  • Atari ST
  • ***
  • Posts: 208
  • Karma: 20
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #16 on: December 12, 2013 »
it sounds like your really close!

if your texture is showing ok in gDEB and the updates are happening at the right time. the problem must either be coming from the second layer
hope so.. convinced now its a quirk with the second layer setup texture stuff/the shader.

sometimes strip everything back by block commenting huge chunks of my code out

you'll appreciate this then :) > http://hacksoflife.blogspot.co.uk/2006/01/debugging-opengl.html


Quote
have you thought about recording another take of your demo again closer up + in the dark? "lights out edition"
yeah as soon as i get my good camera back of my friend i will upload a much better video i tried with the lights out with my phone but there was far too much glare..

awesome :)

i guess with other colours, or the ability to vary "fade out" (greyscale?) some other doors would open up.
with a limited palette.. colour cycling?

from the left-field sure i've seen a fully lit OpenGL LED simulation somewhere before too, with the API lined up run the same the "demo" in a virtual scenario

« Last Edit: December 12, 2013 by Canopy »

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1666
  • Karma: 133
    • View Profile
Re: [XMAS_2013] Christmas spirit
« Reply #17 on: December 12, 2013 »
Quote
you'll appreciate this then :) > http://hacksoflife.blogspot.co.uk/2006/01/debugging-opengl.html

love it!  ;D

Quote
i guess with other colours, or the ability to vary "fade out" (greyscale?) some other doors would open up.
with a limited palette.. colour cycling?

from the left-field sure i've seen a fully lit OpenGL LED simulation somewhere before too, with the API lined up run the same the "demo" in a virtual scenario

yeah as with everything thing in our world with enough computational power anything is possible i've done some test with this new maple 70-something mhz arm cortex microcontroller i just got and its giving me roughly 10x the performance of the arduino so i really think full color range rgb starts too become a possibility.

this little project i made for the challenge will definitely evolve into something more as time goes by.
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: [XMAS_2013] Christmas spirit
« Reply #18 on: December 12, 2013 »
I think this is how the Raspberry Pi started out - you could be on the verge of creating a rival 8)
You are our 9001st visitor.
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2698
  • Karma: 483
    • View Profile
    • http://www.rbraz.com/
Re: [XMAS_2013] Christmas spirit
« Reply #19 on: December 21, 2013 »
That's the spirit!
Lots of effects for such small microcontroller.

Trying new things and learning in the process, it's all about of what those compos are for.  :)
Challenge Trophies Won: