Pages: [1]   Go Down
Author Topic: ATTiny85 - Welcome to Las Vegas!  (Read 1270 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Sr. Member
****
Karma: 9
Posts: 272
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A souvenir "Welcome to Las Vegas" sign had broken on me and sat broken for over a year in my office. Finally decided to fix it with the Arduino as both a fun project and a learning exercise for my 12-year old son.

Started with prototyping on an Arduino Uno, using various TIP120 style transistors to switch the 18V LED elements in the sign:


After it was all done and programmed, an ATTiny85 was installed on a breadboard, glued into the base of the sign:


The ATTiny85 fits comfortably into the base, from the outside, the sign looks the same as it came from factory:


Currently, the program is a simple pattern, similar to the actual sign in Vegas.
Down the road, we'll add a button first to cycle through different patterns and ultimately we might switch to a ATMega328 and add Xbee or Ethernet to the mix to use the light as email notifier or something smiley

The result:



Code is attached for reference.

* main.cpp (0.71 KB - downloaded 16 times.)
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 200
Posts: 12772
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Nice work!

Have (had) you considered using a TLC5940?  The 18V is a bit above the maximum but I suspect that would not be a problem.
Logged

Offline Offline
Sr. Member
****
Karma: 9
Posts: 272
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have (had) you considered using a TLC5940?  The 18V is a bit above the maximum but I suspect that would not be a problem.

Nope. Didn't even know what that is until now smiley
Might use something like that in the future.

Honestly wasn't even planning on using the ULN2803, was just going to wire up the transistors directly. But the internal resistors and small footprint of the ULN2803 makes wiring so much neater.
Since the ATTiny85 only has 6 pins, I might at a shift register to free up some ports. That would mean glueing in a larger breadboard though...
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 200
Posts: 12772
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


The TLC5940 does need a total of four connections to the processor which may make it a little difficult to use with a t85.  I know the TLC5940 works well with a t84.

If you don't need PWM (or are willing to mimic it using software), the TLC5916 is a nice inexpensive alternative to the TLC5940 that needs the usual three connections to the processor.
Logged

Melbourne, Australia
Offline Offline
God Member
*****
Karma: 8
Posts: 567
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Apart from the ease of use of TH vs SMD, would you prefer to use the TLC5940 over the PCA9685, which is I2C accessible and free-running?
Logged

Windows serial port monitor: Tellurium | Arduino serial port debugging library: DBG | Cusom LCD char generator | Technical questions will only be answered in forum threads

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 200
Posts: 12772
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


For what I do, I prefer the much higher current / voltage / power limits of the TLC chips.

I use CLKO (CKOUT) for the TLC5940 clock (the fourth connection I mentioned above) which ties up one more processor pin. 

I suspect the sustainable data rate for serial (TLC) is higher than for bus (PCA9685).  I've been getting about a 400Hz refresh rate with a single TLC5916.  I suspect adding a second TLC5916 would have a negligible affect.  I don't think I could do the same with a PCA9685.
Logged

Melbourne, Australia
Offline Offline
God Member
*****
Karma: 8
Posts: 567
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Interesting. Thanks.

I put an order in recently for a bunch of 5940s a week ago, then read about the ADAfruit break out for the PCA. I am wanting to put a few models together, with between 2 and 6 servos. For the 2, 3 & 4 servo models, I was actually thinking an attiny85 hooked up to the 328P main mcu via I2C could be used as a PWM source. I'll have both ICs so experimenting is on the horizon.

Do the TLCs have advantages over the use of another mcu? I realise it can be a bit of overkill, but in my naive frame of mind it seems it could provide some flexibility being able to program smarts into the PWM generator, and even do 2 way communication with it.

Logged

Windows serial port monitor: Tellurium | Arduino serial port debugging library: DBG | Cusom LCD char generator | Technical questions will only be answered in forum threads

Melbourne, Australia
Offline Offline
God Member
*****
Karma: 8
Posts: 567
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh hmm. Are you driving the devices directly from the TLC? The attiny would need FETs or something to drive the servos.
Logged

Windows serial port monitor: Tellurium | Arduino serial port debugging library: DBG | Cusom LCD char generator | Technical questions will only be answered in forum threads

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 200
Posts: 12772
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I am wanting to put a few models together, with between 2 and 6 servos. For the 2, 3 & 4 servo models, I was actually thinking an attiny85 hooked up to the 328P main mcu via I2C could be used as a PWM source. I'll have both ICs so experimenting is on the horizon.

Do the TLCs have advantages over the use of another mcu?

For controlling servos?  I have no idea.
Logged

Global Moderator
Dallas
Online Online
Shannon Member
*****
Karma: 200
Posts: 12772
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh hmm. Are you driving the devices directly from the TLC?

Yes.  Which is one reason I like them (fewer total parts).  And why I suggested them to @int2str.

Quote
The attiny would need FETs or something to drive the servos.

No.  A servo is "driven" by a simple low current (relatively) low voltage signal.  A FET is not necessary when controlling a servo with an AVR processor.

Because the TLC5940 is a constant current sink, I believe you need a transistor (or resistor) for each line when using the TLC5940 with servos.

On their website, Texas Instruments has an application note describing how to use the TLC5940 with servos.
Logged

Melbourne, Australia
Offline Offline
God Member
*****
Karma: 8
Posts: 567
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. I was confusing servos and steppers - I have servos on the brain and the stepper driver I was just looking at in the same mental space.

I'll check out the TI application note.
Logged

Windows serial port monitor: Tellurium | Arduino serial port debugging library: DBG | Cusom LCD char generator | Technical questions will only be answered in forum threads

Pages: [1]   Go Up
Jump to: