venerdì 20 ottobre 2017

Keychainino — a modern keychain for maker


In this post I describe and show how to assemble the keychianino: a keychain for maker and tech enthusiast
It is quite some time I am following the keychainino project on facebook , and I really love it. It is a small keychain full of technology and most of all is fully ptogrammable.

As described by its author: “keychainino is an arduino programmable keychain”, “is a vintage videogame to be used on the bus, on the metro or anytime one is bored and doesn’t know how to spend the time” :)


Below the video of the assembling that I have done


Few days ago I have ordered my keychainino from here [] and now I got it.

Once I have opened the envelop I found a CR2032 battery and a small antistatic bag containing all the necessary components for the assembly of keychainino (PCB, micro controller, led, resistor)

Bill of Material

Below the full list of components part of the kit:
  • Keychianino PCB
  • 30 red Led 
  • 1 100nF Capacitor
  • 1 10 KOhm Resistor
  • 1 CR2032 battery holder
  • 1 CR2032 battery
  • 2 micro push buttons
  • 1 ATTINY84A microcontroller
  • 1 ISP pin header (6 pin)

Assembly tips

Before starting the assembly of the PCB and components let me just share few tips:
  1. Led are polarized components so it is very important to mount them in the right manner (otherwise keychainino will not work properly). The longer led leg is the anode (positive +) while the shorter one is the cathode (negative -)

As shown in the above figure, for each led there are two holes in the PCB. The upper hole is for the cathode (negative -) of the led, while the lower hole is for the anode (positive +) of the led.

2. Base don the design of the PCB, the micro push button must be soldered in one specific position.

In the above picture, “piedini” stands for “pin”.
So if you look at the micro push button from the top, it must be positioned in a way that pins goes from left to right (not from top to bottom).

3. Also the micro controller ATTINY84A must be mounted in a specific position

Looking at the PCB from the top, you can see a space named IC1 which is reserved for the micro controller. The bottom-left pad is marked with a tiny black dot.

In the same way if you look the micro controller from the top, you can see a white triangle

The right alignment of the micro controller on the PCB is when the white triangle is matching the tiny black dot as shown in the above picture


Now that we know those important tips, we can move on with the assembly of keichainino. Suggest to follow this order:


Insert 6 led in the first row of holes from the top. Important to respect the polarization as explained above

A good way to avoid the led moving is to bend its legs as shown in figure

Now that the led are correctly positioned, we can solder each pin of each led

Let’s continue soldering all the led until the last row

Now all the 60 solders of the led are done (I am sure you can solder much better than me) :) — in the end I am a software guy so I am excused :)


Resistors don’t have polariti so it can be soldered in any direction


This is a ceramic capacitor and it doesn’t have any polarity, so feel free to solder it in any direction

Micro Controller

In order to solder the micro controller I have used a more powerful solder (40W) compared to the one used for the LED (this might be or not your case)
Remember to respect the proper alignment of the micro controller chip as explained above

Micro Push Buttons

Remember to solder the push buttons in the right direction as explained above

Battery Holder and ISP connector

In the end our keychainino is fully assembled and ready for gaming!! :)

mercoledì 18 ottobre 2017

ESP8266–01 Home Made Dev Board v1

In this post I describe the way I have designed and built a simple and useful development board for ESP8266–01

The main goal of this board is to make the use of ESP8266–01 simple during development phase on breadboard.


The schema is quite simple.
A detailed explanation on how to correctly connect EPS8266–01 pins is available here []

The pinheader J1 and J2, in the above electrical schema, are the 8 pin of the ESP8266–01 module (as seen from above view)

The 5 pin on the left, in the above electrical schema, are the pin of the dev board. More in detail:
  • VCC: 3V3 (+) from a couple of AA batteries or any other power source (in the schema is writte 5V as I was not able to change it in Fritzing)
  • GND: the negative (-) wire from the two AA batteries or from any DC 3V3 power source
  • USB GND: the ground from the USB2TTL module
  • USB RX/TX: RX/TX from the USB2TTL module
The two pin top-right are the GPIO0 and PIO2 available on the ESP8266–10 module
The pin header J3 and J4 are not electrically connected and wired and are only used to mount the dev board on the breadboard
Two micro-buttons are available to reset the ESP8266–01 module (SW RST) and to switch into flashing/programming mode (SW GPIO0)


The PCB has been made using Fritzing software and is a single side PCB for an easy development at home

Making the PCB

I have use a home made development process to build the PCB which is called “toner transfer”. In short I have printed the circuit on glossy photo paper with a laser printer and later transferred the PCB tracks on the copper clad with a normal iron (borrowed from my wife :) )

The result is not 100% perfect (doing that at home with basic tools) as half track and few pad have not been transferred correctly

No worries, we are maker so we always find a solution. I have manually corrected the missing toner with a permanent maker (the pad which are missing are the one which are not electrically connected so no big issue)
Below the final result after the copper etching

Now I remove the toner with some simple acetone (borrowed from my wife)

now I drill the board with a 1mm drill bit

Assembling the Board

Now it is time to assemble the board with just few components
Here the list of components:

I start by soldering the resistors, the pin header and then the push buttons

Below the final result

and also with ESP8266–01 module

and everything mounted on breadboard


The full fritzing project with electrical schema and PCB layout is available here qui


The two pin header rows on the side of the dev board, are slightly larger than the breadboard. In order to overcame this small issue I have removed the 6th pin from the row.
In version 2 of this board I will fix this bug but until then I can use the dev board with the small trick explained above.
This allows me to work on my project base don ESP8266–01 in a clean and easy way avoiding flying wires.

venerdì 13 ottobre 2017

Control Arduino over Bluetooth

In this post I describe how I connected Arduino Uno (for other Arduino types the wiring are similar) with a JY-MCU HC-06 Bluetooth module I had bought some time ago.

This module allows me to connect via my phone or tablet or PC Bluetooth. The module is seen by Arduino as a serial communication and is therefore easy to manage. I already have a small project in mind for my home with this module, but for the moment, let us concentrate on how to use the module. In order to do it we need to follow the below steps:
  1. Module configuration
  2. Using the module
Below a picture showing the wiring between the Bluetooth module and Arduino

I have used 4 different wires of Black, Brown, Red and Orange color. The wires are connected in the following manner to the Bluetooth module:

  • Black -> VCC
  • Brown -> GND
  • Red -> TX
  • Orange -> RX

Now let’s connect the other side of the wires to Arduino as in the picture below

  • Black -> pin +5V
  • Brown-> pin GND
  • Red-> pin 10
  • Orange-> pin 11

It is important to wire the Bluetooth module to Arduino as described as the configuration software is expecting to have the RX on pin 10 and the TX on pin 11.
So in other words it is a cross connection like this:
  • Bluetooth TX → Arduino RX (pin 10)
  • Bluetooth RX -> Arduino TX (pin 11)

Once the wiring is completed, load the below sketch to your Arduino:



// If you haven't configured your device before use this
#define BLUETOOTH_SPEED 9600
// If you are modifying your existing configuration, use this:
// #define BLUETOOTH_SPEED 57600

#include <softwareserial.h>

// Swap RX/TX connections on bluetooth chip
//   Pin 10 --> Bluetooth TX
//   Pin 11 --> Bluetooth RX
SoftwareSerial mySerial(10, 11); // RX, TX

  The posible baudrates are:
    AT+BAUD4-------9600 - Default for hc-06
    AT+BAUD7------57600 - Johnny-five speed

void setup()
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  Serial.println("Starting config");

  // Should respond with OK

  // Should respond with its version

  // Set pin to 0000

  // Set the name to ROBOT_NAME

  // Set baudrate to 57600


void waitForResponse() {
    while (mySerial.available()) {

void loop() {}

If everything went well you should see in your serial monitor something like the below:

At this stage the Bluetooth module is properly configured and ready to be used for communication with other devices.
The Bluetooth module can be now disconnected from Arduino because we need to connect it slightly differently.
To make sure the module works, I have created a simplest example (see below).
I want to turn ON or turn OFF two LED from my cellphone by sending simple command to Arduino.

The commands have the below simple format
  • PIN: pin number on Arduino
As an example the following command:
sets the pin 10 of Arduino to HIGH
while the command
sets the pin 10 of Arduino to LOW
I have created a very simple circuit wiring on breadboard shown below
I have connected pin 8 and 10 of Arduino to two LED through a current limiting resistor (don’t forget to add a 220 Ohm or similar resistor to protect the LED and the Arduino’s GPIOs).

How you can see the JY-MCU Bluetooth module is connected to Arduino in a different way compared to the configuration phase. More in detail now the wiring is:

  • Black -> pin +5V
  • Brown -> pin GND
  • Red-> pin 0 (RX)
  • Orange-> pin 1 (TX)

This way the Bluetooth module is seen by Arduino as a serial communication. I have created a simple sketch that is awaiting and executes a command received via Bluetooth protocol.
Obviously, the sketch is quite basic and used just to verify the operation and is not solid enough for a more serious use but should help figure out better how use the module itself.

#include &lt'string.h>

//struttura del comando
struct CMD {
  int  pin;  //pin da controllare
  char *cmd; //comando da applicare al pin (ON|OFF)

int i = 0;
int readByte = 0;
char buff[255]; //contiene i dati ricevuti
struct CMD parsed_cmd; //comando ricevuto

void setup()

//pulisce il buffer dopo che e' stato utilizzato
void clear_buff()
  for (i=0; i < 255; i++)
    buff[i] = 0;

//println verso bluetooth
void bt_println(String str)

//print verso bluetooth
void bt_print(String str)

//parsing della stringa ricevuta in un comando da eseguire
//comando ha il seguente formato:  PIN--COMANDO. esempio: 13--OFF; 13--ON
struct CMD read_command(char *command)
  struct CMD cmd;
  const char s[3] = "--";
  char *token;
  token = strtok(command, s); = atoi(token);
  token = strtok(NULL, s);
  cmd.cmd = token;  

  return cmd;

int validate_cmd(struct CMD cmd)
  return (( > 0) && ((String(cmd.cmd) == "ON") || (String(cmd.cmd) == "OFF")));

void execute_cmd(struct CMD cmd)
  int pin =;
  int status = (String(cmd.cmd) == "ON")?HIGH:LOW; 
  bt_println(String("Settin PIN: ") + String(pin) + String(" to ") + String(status));
  pinMode(pin, OUTPUT);
  digitalWrite(pin, status); 

void loop()
  if ((readByte = Serial.available()) > 0) {
    Serial.readBytes(buff, readByte);
    bt_println(String("Parsing commnand: ") + buff);
    parsed_cmd = read_command(buff);
    if (validate_cmd(parsed_cmd)) {   
      bt_println(String("Serial PIN = ") + String(;
      bt_println(String("Serial STATUS = ") + parsed_cmd.cmd);
      bt_println("ERROR: COMMAND NOT VALID!");

Now that we have completed the configuration of the bluetooth module and the wiring of the simple test circuit, we can just load the sketch on Arduino.
To make sure everything works correctly I installed a simple app on my Android phone (for iOS there are similar apps).
The App I have used is called BluetoothTerminal.
This app allows me to type characters (commands) and send them via Bluetooth to my Arduino.
In the video you see that the LEDs turn ON and OFF when I send the correct command to Arduino.
The module I used has a pin equal to 0000 for pairing Bluetooth with the cellphone.