From Randomdata wiki
Revision as of 11:57, 21 December 2013 by Ardillo (Talk | contribs) (code)

Jump to: navigation, search


A special edition christmas arduino workshop. We'll be using a new very small arduino clone called ["Trinket"].
We can make a christmas star/tree with sound effects.
Ardillo did some research and collected a list of parts which can be bought for a fair price.


research: Ardillo
Workshop: Fish_ && Ardillo

Christmas kit

The Trinket is one of the cheapest clone (unless you tinker around yourself).
We've made a DIY christmas kit which consists of the following:

Parts 0xchristmas

amount what price url
1 trinket 5V Logic €8,00 [floris.cc-trinket]
1 breadboard €4,00 [floris.cc-breadboard]
1 USB - mini USB cable €2,08 [Farnell-usb cable]
1 Piezo buzzer €1,00 [Farnell-piezo buzzer]
1 Light Dependant Resistor €0,77 [Farnell-LDR]
2 high power LED's €0,60 [Farnell-LED's]
 ? red/green LED's €?? Randomdata's own supply
 ? jumpers/cables/wire €?? Randomdata's own supply
1 splitted shipping costs €0,56 Farnell & Floris.cc shipping divided by amount of kits
Total €17,01 aproximitly €20

The url's of Farnell are without tax, our price is with 21% tax.

trinket HowTo

During the workshop we tell about arduino's and why they are awesome.
The Trinket is a little different but still easy to work with. It is important to know that your trinket is a 5V Logic version (not the 3.3V). This important when connecting your trinket to sensors, they have to be of the same voltage as your trinket.
Adafruit made a good tutorial on how to use this trinket.

0xchristmas workshop

So for making a Christmas tree/star with sound effects we made a guidance workshop where you are doing all the work and we are just helping.
For connecting everything together we need some jumper wires, there are a couple of ready-to-use cables available or you can make your own from some scrap electronics, especially solid core network cable works fine.

...more to come, still work in progress...

Components explained


0xchristmas trinket2.jpg
source: [adafruit]
The Trinket is a smal microcomputer. It has a processor of the same family as the arduino The Trinket is designed by Adafruit. You can use a small computer like this for turn on LED's or make music with it. It's also possible to connect sensors to it, so you can for example monitor temperature.


0xchristmas breadboard.jpg0xchristmas breadboard2.jpg
source: [floris.cc]
A breadboard is a nifty thing for experimenting with electronic circuits. You can easily make a circuit without soldering, as long as you don't tinker around with high frequency's (like wifi) a breadboard will succeed. The holes in a breadboard are arranged in such a way that they are connected in groups of five.
This way we can connect other parts to each other without having to solder, but just to put the contacts in a hole which is grouped to the part you want it connected to.


0xchristmas cable.jpg
source: [farnell]
Just an ordinary cable nothing more to say. One side has a USB connection for your laptop and the other side has te be connected on your trinket.


no image yet

Light Dependant Resistor

0xchristmas ldr.jpg
source: [farnell]
a Light Dependant Resistor is a special resistor. Its resistance is dependant on the amount of light that his sensor has. This component can be used in automatic lights, which turn on when it's getting dark.

Light Emitting Diode

0xchristmas led.jpg0xchristmas led2.jpg
source: [farnell]
Ligh Emitting Diodes or LED's as we call them are just lights. The more you have, the brighter and happier your project looks. A LED has a + and a - contact. So if you change the polarity the light will not work. So if it's not working, try to switch the legs. You can see the + and - if you look good at the picture. The + contact is always longer. and the - contact has a little flat side on the bottom of the LED bulb.

Piezo buzzer

0xchristmas piezo2.gif0xchristmas piezo.jpg
source: [farnell

Piezo is a strange material which has the ability to transform a bit in shape when a current is going through it. While doing this it makes a specific sound. Therefor Piezo material can be used as a small speaker, or the other way around. Because when touching it Piezo material generates a small current.

...more to come, still work in progress...

What should it look like

For the christmastree look here: Tinkercad - project: 0xchristmastree
Image of breadboard with LED,s and piezo connected.


the arduino code for this project:

  Turns on an LED randomly with values from 50 - 255. This gives a flame like effect.
  This example code is in the public domain.

  To upload to your Gemma or Trinket:
  1) Select the proper board from the Tools->Board Menu
  2) Select USBtinyISP from the Tools->Programmer
  3) Plug in the Gemma/Trinket, make sure you see the green LED lit
  4) For windows, install the USBtiny drivers
  5) Press the button on the Gemma/Trinket - verify you see
     the red LED pulse. This means it is ready to receive data
  6) Click the upload button above within 10 seconds
int led1 = 0; // blink 'digital' pin 1 - AKA the built in red LED

// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led1, OUTPUT);


// the loop routine runs over and over again forever:
void loop() {
    analogWrite(led1, random(205)+50); //120)+135