Showing posts with label RGB. Show all posts
Showing posts with label RGB. Show all posts

Monday, May 24, 2021

Easy module shield -1- (Arduino)

Recently i received another Arduino sensor shield.
It has a reset button and two other push buttons several other sensors.There are some Dupont pins available to add something of your own (e.g. an IR led).

D0( RX see below )
D1( TX see below )
D2SW1 (push button)
D3SW2 (push button)
D4DHT11
D5Buzzer
D6IR receiver
D7(pins with D7 VCC GND)
D8(pins with D7 VCC GND)
D9RGB led (R?)
D10RGB led (R?)
D11RGB led (R?)
D12Led Red D1
D13Led Blue D2
A0Rotation (pot)
A1LDR (Light sensor)
A2LM35 (temeprature sensor)
A3(pins with A3 VCC GND)
A4( I2C SDA see below )
A5( I2C SCL see below )
SDA SCL(pins GND VCC SDA SCL)
TX RX(pins with TX RX VCC GND)
ResetReset button
(power)Power Led


Some names that i have seen for this shield are
Easy module shield
Multifunction (multisensor) Shield Arduino Uno
Multifunction DHT11 LM35 Temperature Humidity Easy Module Shield for Arduino UNO
Multifunction Expansion Board DHT11 LM35 Temperature Humidity For Arduino UNO

The interesting of this relative cheap board is that it contains several hardware items to play with as an  Arduino shield so you do not need to wire these components.

Schematics and some examples can be found at http://www.getmicros.net/a-look-at-the-easy-module-shield-for-arduino.php

As i have seen several times interesting information disappear i placed a copy of the schematics here on my blog. (For the code there are also other resources). 

Perhaps in the future i will post some code examples and experiments you can do with this shield. With the LM35 i did not play before. Also i did read about some problems with the Infrared led on a version of this shield. So i hope i will find time soon to play with this board.

Friday, February 28, 2020

ATTiny Charlieplex 4 RGB leds

Experimented using 4 charlieplexed RGB leds on a attiny85.
This experiment was done some time ago, and due to the result (watch video below) i hesitated to post it as at that time it was not complete successful.  There are several excellent resource that explain charlieplexing. Therefor i will not try to explain it in detail. In short as leds only light up when the current flows in one direction you can control more leds to a circuit.
I used the code below.

CODE

void setup() {              
  // charlieplex 4 RGB leds 0 1 2 3
  // initialize the digital pin as an output.
}

// the loop routine runs over and over again forever:
void loop() {
 int mydelay = 1000;

  LEDon(3, 2);  // 1R
  delay(mydelay);
  LEDon(3, 0);  // 1G
  delay(mydelay);
  LEDon(3, 1);  // 1B
  delay(mydelay);

  LEDon(0, 1);  // 2R
  delay( mydelay );
  LEDon(0, 3);  // 2G
  delay( mydelay );
  LEDon(0, 2);  // 2B
  delay( mydelay );

  LEDon(1, 0);  // 3R
  delay(mydelay);
  LEDon(1, 2);  // 3G
  delay(mydelay);
  LEDon(1, 3);  // 3B
  delay(mydelay);

  LEDon(2, 3);  // 4R
  delay(mydelay);
  LEDon(2, 1);  // 4G
  delay(mydelay);
  LEDon(2, 0);  // 4B
  delay(mydelay);
}

void LEDon( int gnd, int vin) {
  pinMode(0, INPUT);
  pinMode(1, INPUT);
  pinMode(2, INPUT);
  pinMode(3, INPUT);
//  pinMode(4, INPUT);
//  pinMode(5, INPUT);

  pinMode(vin, OUTPUT);
  pinMode(gnd, OUTPUT);
  digitalWrite(vin, HIGH);
  digitalWrite(gnd, LOW);
}

ENDCODE

When you watch the video you seen some unwanted / unexpected flashes of an RGB led.
This is due to the fact that the attiny85 has an on-board led connected to one of the pins. This interferes with the charlieplexing. To remove this unwanted behavior of the RGB led you need to remove this led.
My first idea was to first make a recording of the correct behaving RGB leds before posting everything on my blog. I did not yet made a video recording after modifying an attiny85. However i later made a custom PCB for charlieplexing. I now decided to post it withe the error due to the led and make later a posting about that PCB where you can see the correct functioning of the RGB leds.



Monday, December 23, 2019

ATTiny85 RGB led

An RGB Led with DuPont connectors from a previous post was tested with the attiny85 with Dupont female wires. the wire without resistor was connected to ground and the other led pins with the resistors to P0, P1 and P2.
As program i used the Example DigisparkRGB program. ( Examples \  DigisparkRGB \ DigisparkRGB  ).

#include <DigisparkRGB.h>
/*
 Digispark RGB

 This example shows how to use soft PWM to fade 3 colors.
 Note: This is only necessary for PB2 (pin 2) - Blue, as Red (pin 0) and Green (pin 1) as well as pin 4 support the standard Arduino analogWrite() function.

 This example code is in the public domain.
 */
byte RED = 0;
byte BLUE = 2;
byte GREEN = 1;
byte COLORS[] = {RED, BLUE, GREEN};

// the setup routine runs once when you press reset:
void setup()  {
  DigisparkRGBBegin();
}


void loop ()
{
//direction: up = true, down = false
boolean dir = true;
int i = 0;

while(1)
{
fade(COLORS[i%3], dir);
i++;
dir = !dir;
}
}
void fade(byte Led, boolean dir)
{
int i;

//if fading up
if (dir)
{
for (i = 0; i < 256; i++)
{
DigisparkRGB(Led, i);
DigisparkRGBDelay(25);//1);
}
}
else
{
for (i = 255; i >= 0; i--)
{
DigisparkRGB(Led, i);
DigisparkRGBDelay(25);//1);
}
}
}


A video of the result was posted on my YouTube channel :
(At that time this blogpost was not yet ready for publishing.)

As i was not very happy with the recorded colors, i tried to improve it by putting a white paper below the led. However the improvement was only minor and the real colors are different. I hope the video will at least give a little impression of the changing colors.
As all the colors are faded in the program i did not specially select the led color pins to be matched to the colors in the program (  RED = 0;  BLUE = 2;  GREEN = 1; )


Tuesday, August 13, 2019

Flexible USB led light -1-

Making a custom flexible USB led

Building a flexible USB led.
It is possible to buy a cheap flexible led (or fan or other device) with an USB connector. It is more fun to build your own where you can use some special led's.  I created several different flexible USB devices. A fast flashing RGB led gives a nice effect.
The USB connector provides 5 Volts. After selecting a  led your own choice add a small resistor to limit the current. Shortened the legs of the led and added long red and black wires for power connection.
Led and resistor with red and black cable
 and  flexible hose.
With transparent heat shrink it is possible to isolate the wires and keep the resistor (value) readable.
A flexible oil hose (also available on Aliexpress) is used as a housing to make it flexible and stable at the same time. In this version i removed the connectors from the hose. It is also possible to change the hose length.
 For the power connector i used also some USB connectors from Aliexpress, an USB connector from an old cable can also be used.
USB
At the USB side of the hose cut away some of the plastic of the hose to make later a better connection. Take care to connect the + to plus and - to minus. By pushing wires and the led inside the hose you can cut the wires easy to the desired length.
After soldering i pushed in the USB connector back in the hose. With the correct wire length the led will just pop out of the other end of the hose. With hot glue the USB connector is glued to the hose.
USB connector and USB chassis part
 for testing and checking plus and minus.









Links to some Aliexpress items i bought (in 2019) to use in this project.

Fast RGB Flash leds
20 pcs 5mm Fast RGB Flash Red Green Blue Rainbow Multi Color light emitting diode Round Rainbow LED can change more than 7 color  (  € 0,89 for 20 pc)
Emitted Colour:RGB Rainbow Fast Flash
Rainbow LED can change more than 7 color
Size:5mm
long life 100000hrs (Voltage in the range of)
Energy saving and high efficiency
Super brightness
Operating temperature: -20 to 55°C
Storage temperature: -30 to 80°C
Forward Voltage(V):3-3.2V
Forward Current(mA):20
View Angle:About 25 degree
Luminous Intensity:Highlight
1 / 4W resistor corresponding voltage (For reference)
12V for 470 ohm/ 5V for 100 ohm/ 7.2v for 220 ohm / 9v for 330 ohm / 13.2v for 560 ohm

WSFS Hot 10PCS Round Nozzle 1/4PT Flexible Oil Coolant Pipe Hose Blue Orange For CNC Machine Lathe Milling Cooling Tube Retail    (  € 6,00 to € 7,00  for a lot with 10 pc)

10Pcs/Set DIY USB 2.0 Type A Male 4P Adapter Connector Plug Socket with Plastic Shell (10 pieces for 1,90 euro)

Wednesday, July 24, 2019

RGB led for experiments

For easy experimenting added resistors and a Dupont connector to a 'normal through hole' RGB led. Transparent heat shrink was added for electrical insulation and to keep the resistors (and the common pin wire) visible.