# ATTiny85 RGB Lamp

#### k1ng 1337

Joined Sep 11, 2020
584
Hey,

I'm building a lamp based on an RGB LED and the ATTiny85 microcontroller and would like some feedback on the design. Since the ATTiny85 has 2 PWM channels, only two of the three colours will be active at a time. The following circuit is intended to select which two colours are active with the respective PWM signals. The circuit appears to work in the simulator however I am unsure of the locations of the PNP transistors and how high I can make all base resistor values to reduce power consumption.

Notes on the circuit: 1) The RBG LED has been split into three LEDs which represent a common anode RBG LED. 2) Switches U1 & U2 have been added to the circuit to aid simulation which represent the digital pins of the microcontroller sourcing / sinking current. 3) All transistors are 2N3904 & 2N3906.

Feel free to lecture at your leisure.

Regards,
Mark

#### Ya’akov

Joined Jan 27, 2019
5,998
There are 3 PWM capable pins on the ATTiny85, hardware pins 3, 5, and 6.

#### k1ng 1337

Joined Sep 11, 2020
584
There are 3 PWM capable pins on the ATTiny85, hardware pins 3, 5, and 6.
Ok so there is support for the third pin with the Arduino IDE. The guides I found had custom settings to enable the third and fourth pins. Doesn't seem to be the case with Reloadron's example.

Anything I should know about the third pin that makes it different and why support was added for it later?

#### Ya’akov

Joined Jan 27, 2019
5,998
Ok so there is support for the third pin with the Arduino IDE. The guides I found had custom settings to enable the third and fourth pins. Doesn't seem to be the case with Reloadron's example.

Anything I should know about the third pin that makes it different and why support was added for it later?
Actually, there are four timers, three are easily used for PWM. It wasn't really added later, it was just the improvement of the Arduino core for the ATTiny85.

#### k1ng 1337

Joined Sep 11, 2020
584
Actually, there are four timers, three are easily used for PWM. It wasn't really added later, it was just the improvement of the Arduino core for the ATTiny85.
I read it had two timers with complementary outputs making four pwm outputs possible. An impressive little chip if I do say so myself.

Now that I've sampled barebones ATTiny85 and ATMega328, was thinking about picking up a bunch of esp32 modules such as these.

I seen you advocate Espressif products so I thought you might be a guy to ask which is best for an amateur.

#### Ya’akov

Joined Jan 27, 2019
5,998
I read it had two timers with complementary outputs making four pwm outputs possible. An impressive little chip if I do say so myself.

Now that I've sampled barebones ATTiny85 and ATMega328, was thinking about picking up a bunch of esp32 modules such as these.

I seen you advocate Espressif products so I thought you might be a guy to ask which is best for an amateur.
I like the Atmel Tiny MCU but they ae an entirely different thing from any ESP32. What is the application that you have in mind?

Joined Jan 15, 2015
6,698
I haven't played with the linked esp32 flavor yet. Not that one anyway. Hopefully Ya'akov can add some. Yeah, the little ATTiny 85 is a handy little chip considering size and what it can do. Uh I see Ya'akov is here.

Ron

#### k1ng 1337

Joined Sep 11, 2020
584
I like the Atmel Tiny MCU but they ae an entirely different thing from any ESP32. What is the application that you have in mind?
Adding wireless capabilities to my projects. Trinkets and gadgets, things of that sort. I have the materials to assemble several boards and for $4 each (twice what the ATTiny85 cost) it looks like a lot can be had for a little. #### Ya’akov Joined Jan 27, 2019 5,998 Adding wireless capabilities to my projects. Trinkets and gadgets, things of that sort. I have the materials to assemble several boards and for$4 each (twice what the ATTiny85 cost) it looks like a lot can be had for a little.
Well, the ESP32 comes in several varieties. The ESP32-S3 SoC is incredibly capable. It has a 233MHz dual core processor. It has WIFi, of course, as well as Bluetooth 5, but is also has a surprising array of peripherals including an RTC, 41 GPIOs, 3 each ADC (12-bit) and DAC (10-bit), SPI and I²C, a cosine wave generator, and hardware support for SHA, AES, and RSA algorithms. This is a wildly incomplete list, see the block diagram below.

So, if you really just need to add WiFi, the ESP-01 ESP8266 module would be sufficient but if you want to learn and use the ESP32-S3, I certainly encourage and support it. The Arduino support is very solid now as well.

#### k1ng 1337

Joined Sep 11, 2020
584
Well, the ESP32 comes in several varieties. The ESP32-S3 SoC is incredibly capable. It has a 233MHz dual core processor. It has WIFi, of course, as well as Bluetooth 5, but is also has a surprising array of peripherals including an RTC, 41 GPIOs, 3 each ADC (12-bit) and DAC (10-bit), SPI and I²C, a cosine wave generator, and hardware support for SHA, AES, and RSA algorithms. This is a wildly incomplete list, see the block diagram below.

So, if you really just need to add WiFi, the ESP-01 ESP8266 module would be sufficient but if you want to learn and use the ESP32-S3, I certainly encourage and support it. The Arduino support is very solid now as well.
Is there a particular module or development board you recommend for getting started? I had one idea of making an array of wireless modules that can be placed or deployed wherever for sensor related tasks. Similar to the devices in the movie Twister but not in that context.

#### Ya’akov

Joined Jan 27, 2019
5,998
Is there a particular module or development board you recommend for getting started? I had one idea of making an array of wireless modules that can be placed or deployed wherever for sensor related tasks. Similar to the devices in the movie Twister but not in that context.
TO get started with the ESP32 I would suggest the ESP32-S3-DevKit-C which is a great board to learn from. It's an official Espressif product. It has support in the Arudino IDE and for CircuitPython and of course in Espressif's own development environment.

Notice how little is on the board itself, USB connectors for serial and and OTG, a CP2102 TTL to USB serial converter, a couple of tactile, a WS8212B addressable RGB LED, and a hefty 3.3V regulator.​

It's 15 bucks but the ESP32-S3-WROOM-1 module on it is only about 4 bucks depending on the version. And you can get a minimalist adapter board for it so you can put header pins on it for Dupont wires or through hole use. or one made like this which makes the module pluggable of programming or development.

You can use pogo pins on the backside​

#### k1ng 1337

Joined Sep 11, 2020
584
TO get started with the ESP32 I would suggest the ESP32-S3-DevKit-C which is a great board to learn from. It's an official Espressif product. It has support in the Arudino IDE and for CircuitPython and of course in Espressif's own development environment.

View attachment 267885

Notice how little is on the board itself, USB connectors for serial and and OTG, a CP2102 TTL to USB serial converter, a couple of tactile, a WS8212B addressable RGB LED, and a hefty 3.3V regulator.​

It's 15 bucks but the ESP32-S3-WROOM-1 module on it is only about 4 bucks depending on the version. And you can get a minimalist adapter board for it so you can put header pins on it for Dupont wires or through hole use. or one made like this which makes the module pluggable of programming or development.

View attachment 267883 View attachment 267884
You can use pogo pins on the backside​
Thanks for the information. I think I'll go for a few modules and the adapter for programming. The only thing that seems a bit daunting is regulating the input voltage which for the money may be worth buying the development boards instead.

#### Ya’akov

Joined Jan 27, 2019
5,998
Thanks for the information. I think I'll go for a few modules and the adapter for programming. The only thing that seems a bit daunting is regulating the input voltage which for the money may be worth buying the development boards instead.
Before you order the modules, look at this. You have to choose the memory configuration, and WiFi+BT or just WiFi, and antenna which affects the price. To start, you just need some of everything, and the PCB antenna, not the max of everything or of one thing. In the future you might find you need a certain mix of memory types or WIFi only, with on-board antenna or not.

#### bassbindevil

Joined Jan 23, 2014
457
There are designs like the Blinkstick for controlling RGB LEDs through USB.