1
\$\begingroup\$

at the moment I am planning my first real (big) electronics project. I want to build a LED lamp, that can be controlled by a RaspberryPi (for e.g. programming a binary clock or changing the brightness according time of day). I built this schematic for the project (also at the end of the question as a image, as this is a .pdf).

There are two main problems giving me headaches:

  1. I wonder if the LEDs will be a) faded/animated smoothly and b) provided constant/non-fluctuating power, because there are a Pi, a AtTiny, five TLC5940 and far too many other LEDs. I currently want to use a fairly standard switching power supply

  2. I have no experience at all with µControllers except a little bit of arduino testing, so, will my idea of using the Pi to write the PWM data (at inconsistent timings) while using the attiny for clocking the TLC5940s (at consistent timings) work? I intended to send a READY signal from the Pi to the attiny so it knows it can BLANK and restart the PWM counters and maybe can slow down a bit (it has a too high clock speed for this application anyway, doesn't it), though I have no idea how to the latter program at this point.

so, yeah, I would greatly appreciate it if someone has any ideas for these two issues

as a little more information here is a "blueprint" like drawing of the lamp :D

thanks in advance!

The schematic for my project

EDIT: Just noticed I confused the XLAT and XERR ... I want to read the error flags and have an output to the latches, not the other way around. I'll leave as it is for the time being though

\$\endgroup\$
  • \$\begingroup\$ here also is a small animation for the lamp :D (sorry for the noise) \$\endgroup\$ – Yasu11 Aug 31 '14 at 4:19
  • \$\begingroup\$ @gbulme okay ... then ... do you know a good filehoster that doesn't have pop-ups and all that stuff? I allways don't know where to upload, so I use another hoster every time ... \$\endgroup\$ – Yasu11 Aug 31 '14 at 13:10
1
\$\begingroup\$

So the idea is to drive the grayscale clock (GSCLK) from the ATtiny, and everything else from the R-Pi?

Driving the TLC5940 with two different sources does not look impossible to get working.

However it will likely create extra complexity. Debugging the source of an error may be very challenging. As this is your first major electronics project, I'd recommend making it easy to get working, and then make it better.

I think I might be somewhat concerned about using the R-Pi for such a complex timing-sensitive device too. (As you have identified, the interaction between the grayscale clock and blanking signals seems complex, though with experiments it might actually be simpler in practice)

However, if you already have one, I would try the R-Pi and see. Do this initially without using grayscale, as that removes the ATtiny's role, and so it will implement everything else. IIRC there is a simple PWM generator on a R-Pi. It takes a bit pattern, and shifts that out to produce some sort of square wave.

If the R-Pi wasn't good enough, or you haven't got one already, I would suggest a cheap Arduino Nano clone from one of the well-know shopping sites (not Arduino Mini, which is lacking USB, unless you already have a USB-to-serial converter).

The Arduino has enough pins to drive everything, so there is only one place to debug.

Programming an Arduino will be easier than an ATtiny, and there are lots more people who might help if you have problems.

Once the system is working, and if you are still determined to implement your original approach, you could still reverse back to your initial idea, using the Arduino to play the ATtiny's role. Once that works, swap out the Arduino, and use the ATtiny.

This might seem more complex than your original plan. However, being able to implement a project in smaller stages, and get each stage working, with debuggable pieces, can significantly reduce the time to complete everything.

Edit:
If low-cost is part of what interests you, and you plan to do several projects in this area, consider getting a USB-to-serial converter. Then you can use Arduino Mini clones, which are available for under £2/€2/$2.50. It would be pretty hard to make something using retail price ATtiny's and components at lower-cost. The mini is easier to program than an ATtiny, and has a lot more resources. Even if all you use it for is a square wave generator and a bit of logic, it is economical, flexible, quick-to-use and well supported.

If low-cost is part of the interest, I might look for something lower-cost than TL5940 (though they are surprisingly low-cost), and do some of its functions (e.g. grayscale) in the Arduino. However, try to keep the project easy to do in small steps.

I wouldn't use an R-Pi, unless there is more to the projects than you have described in your question.

\$\endgroup\$
  • \$\begingroup\$ I allready thought about the change to arduino for controlling, yet I aimed to get a way lower price with the attiny version. Looking at ebay now though and seeing prices as low as 5€ I'll probably go with that.I allready have a RasPi and a Arduino Leonardo (which I intended to use for other testing) \$\endgroup\$ – Yasu11 Aug 31 '14 at 14:27
  • \$\begingroup\$ @Yasu11 - so you don't need to buy anything initially, you can use the Leonardo! \$\endgroup\$ – gbulmer Aug 31 '14 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.