/aDock

A IoT hub based on Arduino to interact with an Android device (through serial USB) and control some home appliances.

Primary LanguageArduino

aDock

An Arduino based IoT dock station for Android phones to control some home appliances:

  • a TV through infrared remote;
  • a lamp or something to switch on and off through a 110V/220V AC output relay;
  • a (hacked) Sennheiser SD Office 1 Headset through two optocouplers.

aDock was originally developed to be used as an assistive technology device for people with severe physical disabilities, like tetraplegia.

aDock

Hardware

  • 1 x Arduino Board (a Uno will work);
  • 1 x ProtoScrewShield;
  • 1 x basic 16x2 character LCD display, like the LCD ROHS 1602B;
  • 1 x 12V relay circuit mounted on a PCB-like board like the one described here. You can see a simplified schematics and simulation here;
  • 1 x "Max Power IR LED Kit" circuit together with an IR Receiver Diode (e.g. like the TSOP38238 mounted on a single PCB small board. You can see a simplified schematics and simulation here (only the sending part);
  • 2 x optocouplers (I used the Vishay MOC8101 but anything that works with TTL input will work, like the 4N35 in the Arduino Starter Kit);
  • 2 x LEDs (one yellow, one blue, if you like);
  • 4 x momentary push-buttons;
  • 1 x 10 or 20 KOhms trim-pot;
  • 1 x 100 Ohm;
  • 2 x 330 Ohm resistors;
  • 4 x standard 3.5mm female mono audio jacks to plug to the optocouplers outputs;
  • 1 x 12VDC power source (yes, you will need a 12VDC output power source to supply enough voltage for the 12V relay).

Hookup Guide

In a very quick and simplified way, everything should be connected like this:

1) Connect the LCD:

	LCD 1602B     Arduino
	---------------------
	 16 (K)   ->  GND
	 15 (A)   ->  5V (if you want the backlight on)
	  1 (VSS) ->  GND
	  2 (VDD) ->  5V
	  3 (V0)  ->  trim-pot's wiper (output) - Note: wire the others pot's terminals to +5V and GND. (Note on note: pots have no polarity.)
	  4 (RS)  ->  10
	  5 (R/W) ->  GND
	  6 (E)   ->  - (not used)
	  7 (DB0) ->  - (not used)
	  8 (DB1) ->  - (not used)
	  9 (DB2) ->  - (not used)
	 10 (DB3) ->  - (not used)
	 11 (DB4) ->  8
	 12 (DB5) ->  7
	 13 (DB6) ->  6
	 14 (DB7) ->  5

That way the LCD should be initiated like this in the code:

LiquidCrystal lcd(10,  9, 8, 7, 6, 5);

2) Connect the relay circuit:

	Arduino         Relay board
	----------------------------
		VIN     ->  12V
	    GND     ->  GND
	    14 (A0) ->  CTL

3) Connect the infrared circuit:

	Arduino      IR board
	---------------------
		 5V  ->  VCC
	    GND  ->  GND
	      2  ->  RCV (IR sensor output)
		  3  ->  CTL (driving transistor input for the IR LED)
	      4  ->  CTL (just a status LED)

4) Connect the two optocouplers:

Digital pins 11 and 12 go to pin 1 (input +) of each chip through a 330 Ohms resistor each and ground to pin 2 (input -). Then, connect the two 3.5mm female audio jacks to the optocouplers' outputs: wire the tip to pin 5 (output +) and the sleeve to pin 4 (output -);

5) Connect the LEDs:

The blue LED goes to the Arduino A1 pin (digital pin 15) through a 100 Ohms resistor and the yellow to pin 13 through a 330 Ohms resistor (Note: the ProtoScrewShield have this last connection on the shield).

6) Connect the push-buttons:

Wire the 4 push-buttons to Arduino pins A2, A3, A4 and A5 --- they will be used as digital input pins 16, 17, 18 and 19, respectively.

External dependencies

You will need the following Arduino libraries:

  • LyquidCrystal: allows an Arduino board to control standard LiquidCrystal displays (LCDs);
  • IRremote: Infrared remote library for Arduino: send and receive infrared signals with multiple protocols.

Installation

Download the archive from GitHub, decompress it, and run it :) Make sure you have all the libraries above correctly installed in your Arduino development environment before opening the code. If not, you will need to restart the Arduino IDE after installing the libs.

References

Some parts of the code were based on the following references:

For Android communication with Arduino through serial USB take a look at the following links:

Other information

Nothing else to say for now ;-)