1 MCU for 1 house, addressing and buttons

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
I already know hot to program a PIC MCU to have a keyboard, LCD display, PWM, timers, comparators, ADCs, digital I/O, SPI EEPROM, I2C EEPROM, RS232. But I wonder how will 1 MCU be enough to automate the whole house. With the keyboard I can make maybe 40 combinations with only 7 pins, will this be enough? Should I use logical elements to address "256" devices with 8 pins on 1 port, should I use more MCUs and setup some communication with them? I also want to add sooner or later an external "28J60" wi-fi adapter or an MCU with an internal "J60" adapter like "PIC18F97J60", "PIC18F87J60". Can someone tell me what is the general practice?
 

ScottWang

Joined Aug 23, 2012
7,397
Could you draw a block diagram or you already have one?
One uC will be limits by the running time(or scanning time) of whole system, I think you should talk some more then when we give you the suggestion will be more match what you want.
 

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
I am sorry, I think I didnt make myself clear: the idea is this, I know how to program the MCU and make the circuit, I will be using PIC16F877A until I decide to add a "wi-fi" adapter. Until then on 1 port I have the keyboard (PORTA plus the 3 pins on PORTE), on PORTC I have the LCD display, and than I have to turn "ON" and "OFF" a lot of devices, how is the common practice, that I put logical elements on the last free port (PORTD) and index 256 devices or just use the pins to switch 8 things. It bothers me because when the MCU indexes a second device, the pins for the first one will be turned off, that means that I will not constantly be giving a "high" "5V" from the pin, I will do it for a short time and then turn off the pin, that way I will output the combinations from "0 to 255", whenever a button is pressed and then turn the port off again. Is this ok, if I turn the pin off, wont that stop the device as well, this is why I was asking how to control "256" devices with 1 MCU?
 

jayanthd

Joined Jul 4, 2015
945
Use PS/2 Keyboard with mikroC PRO PIC's PS/2 librray to interface 101 keyboard. It will save some pins.

I have used it and it works fine but I have not used PS/2 to USB converter with a USB keyboard. I have to try it.

PS/2 keyboard are difficult to obtain now and also cost more.
 

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
I dont need to. Thank you for the offer! What I want to know is: the common practice would be to output the pin high and leave it high, or to output a combination on PORTX to a logical element (lets say "00010111") for a short time and then return it to "00000000"? If I use combination, than I would need some hardware to leave on whatever is that I have turned on after the port is returned to only "0s".
 

ScottWang

Joined Aug 23, 2012
7,397
No circuit or block diagram, I only can guess that you may need to add some 74HC574 in you application, or maybe some CD4051 or cd4067.
 

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
Which option of the 2 MCUs should I use to turn on and off devices? Should it be addressing "256" devices with 1 port, or just have 1 pin on and off for 1 device?
 

Attachments

jayanthd

Joined Jul 4, 2015
945
How does this "8-Way DIP Switch" switch work?
Maybe I have not understood your exact requirement. Can you explain more.

If a pair of device has to communicate using wired or wireless connection then it needs addressing. So, DIP switch on master and slave set to same address will communicate.

DIP switch is used to set device address.
 

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
Yes you understood. I believe the relay will be on the other side of the switch and when I give the address from the MCU, the switch will be set to this address also and will activate the device on the other side?
 

jayanthd

Joined Jul 4, 2015
945
Yes you understood. I believe the relay will be on the other side of the switch and when I give the address from the MCU, the switch will be set to this address also and will activate the device on the other side?
This project which I made uses DIP Switch for setting the address for device. Only matching address devices will communicate.

https://forum.allaboutcircuits.com/...-simple-mosfet-h-bridge-problem.138358/page-4

This is another project which doesn't use DIP-Switches. Address is set in code (hardcoded). For each harcoded address you have to compile the project with that address. See video.
 

Attachments

Papabravo

Joined Feb 24, 2006
21,159
The single MCU approach suffers from the problem of "home run wiring". That is every device requires a pair of wires to connect to the MCU. The better idea is to implement a network that distributes power and data to remote locations. The wiring you do is a single network cable. The devices on the network can be as simple as one input or one output. They can also have multiple inputs and outputs of either the analog or the digital variety. This flexibility has another advantage. You can expand the network by adding devices to the existing cable plant. No need to tear things up to run more wire.
 

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
You are referring to the telegraphic equation (the longer the cable, the more the losses do to Omh's law and the fact that the wire has resistance)?

I was thinking of implementing a bluetooth module with HC-05 and adding more than 1 MCU or addressing "256" devices with 1 port. But I have a problem with inputting "256" devices to 1 port. All I can think of is a keyboard with "3x4", "4x4" or "8x8". However the combination of keys is difficult, I got the point where I can combine "3 keys", 1 from every column. I have to review the PS/2 keyboard, but I dont know if they have any option of putting it on a wall so I can control everything or doing it from my phone.

Is this the standard approach, more than 1 MCU?
1 option would be to send a bluetooth signal to all the MCUs, but I dont know how to address bluetooth devices. The other option is to have 1 main MCU which will take the bluetooth signal and distribute it to the other MCUs through wiring (again I dont know how to address bluetooth devices).
 

Thread Starter

ArakelTheDragon

Joined Nov 18, 2016
1,362
I am guessing that every bluetooth module will show in some way on my phone, but is this something that a customer would accept, am doing it right or now?

How to change the bluetooth names of the devices to "Living room", "Bedroom" and so on?

EDIT:
Wont that be a security problem ?
 
Top