I am an absolute beginner and wanted to build a simple home automation system using DTMF module using this guide. My problem is out of 12 pins most of them are getting used in DTMF module(5) and the relay module(4). So how do i add an LCD display to it?
-
What DTMF module? What relay? What you want to control? Lights? Heaters? How do you want to interact with your project? Keypad? Android app?– user31481Commented Aug 9, 2017 at 8:08
-
2Use an I2C LCD adapter. Requires only I2C pins (A4 and A5).– Mikael PatelCommented Aug 9, 2017 at 8:11
-
Congrats! But it's better to start with simpler projects to develop your skills and test the components for your final project. For example, you need to know the difference between electromechanical relays and SSR, because what works in theory not always works in practice.– user31481Commented Aug 9, 2017 at 8:21
-
Get a bigger board with more IO...?– MajenkoCommented Aug 9, 2017 at 8:23
-
2Do you know you can use the Analog pins as Digital pins, so there are another 6 there?– Code GorillaCommented Aug 9, 2017 at 12:15
5 Answers
You are using 8 GPIO pins for your existing modules. That leaves 12 left for an LCD (assuming you aren't using the serial port).
An LCD can work from as few as 6 pins (4 data, E and RS) - WR can be tied LOW and RESET can be tied HIGH, and the remaining 4 data pins left floating (or tied low).
That still leaves you 6 pins to do other things. Or 4 if you (advisedly) steer clear of using pins 0/1 for anything.
I suggest you first try every component separately (or if you are new to Arduino, try first simpler components like LEDs, switches etc),
As told by others the following components are easier to use:
Use a matrix keypad, see for example keypad. To reduce the number of pins you can use a multiplexer, such as 74HC165. 74HC165 are very cheap, although they need some additional programming and are slower than using direct pins (although for a keypad you will not notice).
Use a display like 1602 or 2004. See example at 1602 Display. Make sure you order one that has an I2C adapter attached to it (or solder it yourself if you feel comfortable).
After you tested all components separately (make different sketches and save them in case you need them later), you can combine them.
You can use arduino mega rather than uno or nano .... Or can use **I2C adapter to control your LCD display, I2C adapter only needs two pins to communicate with arduino and is easy to use ...... **
You have chosen a mighty task as your first project. I suggest that you run through as many of the example programs as possible before undertaking your project.
Firstly, I would recommend a matrix keypad instead of the DTMF keypad as it is much easier to use with an Arduino. This will also allow you to use a multiplexer which would use fewer pins.
I2C allows you to communicate to the LCD with only 2 pins. Here is such a I2C LCD (with buttons) sold by Adafruit.
As well as the tutorial over at Adafruit, there is a tutorial on such a topic over at ArduinoInfo.
Alternatively, you could upgrade to a Arduino Mega which has 54 IO pins as apposed to 14 on the Arduino Uno.
If some of the pins aren't used at the same time there are ways to reuse them.
Otherwise use a serial shifter or o.o expanders to drive the LCD. 2 to 3 pins max. Even 1 pin is possible if you tolerate lower speed of update.