How to control a lamp via Arduino

In the last posts I wrote that I bought a lot of Arduino stuff, to try to build something interesting, but I didn’t show anything.

This is the first example, the easiest: how to control a lamp.

Ingredients:

The circuit and the code it’s super easy and it’s on GitHub.

Code explanation:

  1. in setup() we declare that pin 7 is an output
  2. in loop() we turn on pin 7
  3. We wait 10000 milliseconds (10 seconds) before running next instruction
  4. We turn off pin 7
  5. We wait another 100000 milliseconds
  6. We start again from point 2

The result is that we have turn on and off the lamp every 10 seconds.

Obviously, this is an useless circuit, but we can expand it, for example by controlling the lamp via Bluetooth or via WiFi.

The real flick keyboard

As an April Fool’s Google Japan made a Flick physical keyboard.

usecase

Designed for those who, accustomed to a flick keyboard on Android / iOS, is no longer able to use one for traditional computers. The website introduces it very well, even though he exaggerates with the functionality, with a laser tracking system that would look unrealistic even in science fiction movies.

What’s really interesting thing is that they made available the source code: one could actually make this keyboard at home with Arduino, although it lacks a fundamental thing: the files for the 3D printer. Yes, I can recreate it at home, but the little box and cute keys? You have to design them yourself.

With the “recipe” that have published, what comes out is something like this:

device

Which it is quite different than the cool prototype shown in the video.

However, it works. With 12 analog nubs from a PS2 pad, they convert the 24 analog inputs to digital using three MCP3208 ICs, using only 5 digital inputs on the arduino nano, while the nub click is directly connected to the remaining 12 digital/analog inputs. After that, the program communicates via serial port with a card, and is seen as a bluetooth keyboard.

Despite the cool looking prototype, in my opinion it’s actually awkward to use. If each key is using a PS2 analog stick, the click is much harder than one key on a standard keyboard, ok, maybe you can write a sentence, but a longer text? Best wishes!

More Arduino, more!

Ok, I’m getting addicted to this, after making interactive Xmas gifts with a Nokia 3310 LCD screen instead of the usual, boring greeting card (I’ll publish the video… one day), I searched the web for lots and lots of fun projects to make.

First, I found a better store than Dealextreme: Banggood.

Not only they have more stuff, it’s also cheaper! 😍

I ordered:

Arduinomania

Last week I was excited that Dealextreme opened a warehouse in Europe.

Browsing the website I saw that there are a lot of Arduino accessories, the DIY programmable electronic platform. I was about to buy a Raspberry Pi B+, but the idea of having a full fledged Linux system just for doing, for example, a simple temperature logging circuit, looked like a waste for me.

Seeing the many components, I got a lot of nice ideas to make, that obviously I’ll publish here, with circuits and source codes.

From the European warehouse I ordered:

  • An Arduino Nano (chinese clone, obviosly, since it costs just 7 euro)
  • A pair of breadboards to quickly do the circuit without using the solder. Moreover the Arduino Nano it’s designed to be put on a breadboard to easily access its contacts
  • A breadboard power supply to put on the breadboard, for having current on the rails more easily, without jumpers (1,60 euro!!)
  • A lot of random resistors
  • A lot of random LEDs (here I could save some money by scavenging them from old circuit boards, but I was lazy)
  • A lot of male jumpers for the breadboard (here I could save too, if I just bought some telephone cable, but for 2,48€, this is nicer)
  • A lot of female jumpers (2,06 €, I could take them from old electronic connectors)
  • temperature sensor. The DHT11 model costs less than half the price, but reading the datasheet, it gives the temperature with a 1 degree tolerance… it can’t be used to log reliably home temperatures. The one I chose, the DHT22, it’s still a cheap sensor that gives temperature with an half degree tolerance. I’ll just use it for see if my idea is feasible and then replace with a SHT15 (which, at $45, it’s not fit for experiments…)

Then I ordered more from the Chinese warehouse, for the simple reason that was cheaper – meanwhile I have to learn how to use the platform, so if they arrive after 2 months it’s still ok:

  • An Arduino Uno (still a chinese clone, because it sells for 5 euro)
  • A board with SD card reader and real time clock, designed to be placed over the Arduino Uno, for logging events.
  • mini breadboard that I’ll glue over the logging board, so I don’t have to mess with solder
  • A Nokia 3310 LCD display already soldered with a controller, ready for being used with the Arduino. Less than 3 euro, cool!
  • An USB voltmeter/amperometer to see if the output from my chinese USB power suppliers is right or not (maybe the circuit doesn’t work because it gets 4.5 volts instead of 5, for example)

I’m eager to get this stuff, to make something cool!