Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Home automation using ESP8266 and Xbee

Status
Not open for further replies.

zazas321

New Member
Hello guys. I would like some advice from those who have some experience in ESP and Xbee field.
I am working on a home automation project as such:
https://electrosome.com/home-automation-arduino-esp8266/
I have a few questions:
1. Is it possible to add Xbee S2 to the project below?
Home-Automation-System-using-Arduino-and-ESP8266-Circuit-Diagram.jpg


The reason why I would like to add an Xbee is to get rid of the wiring from digital pins of the Arduino to devices. My idea was to have an ESP connected to arduino as such, which would allow me to trigger arduino digital pins with a mobile phone app ( such as blynk). Arduino would connect to coordinator Xbee which would be reading the same pin that ESP have triggered. When Xbee receives a signal that the digital pin of arduino has been triggered, the signal would then be sent to a router Xbee device which would turn ON/OFF the device.

So first of all, is it possible to have a digital pin to act both as an input and output? Because the same digital pin would act as an output to ESP but input to Xbee?

Secondly, I would need 3 RX and 3TX pins: 1 for programming the arduino, second one for communication with Xbee, and third one for communication with ESP. Arduino UNO does not have that many pins so I would assume that I would have to use Arduino mega.



Also, I was just curious, whether it would be possible to use Nodemcu development board such as:
113990105_1_1024x1024.jpg


Maybe I would be able to use this board which has built in ESP8266 module together with Xbee instead? I would save a lot of component save and I would not need an arduino at all!

Any advice is appreciated! Thank you
 
Its possible, but a bit tricky. I have not used the Xbee, as for the nodeMCU the programming is not well documented and hard to find. The pin layout is ambiguous and you never know which pin you are activating until you test it. I recommend a microchip wifi module and MCU.

The nodeMCU has 2 RX/TX sets of pins(not confirmed: 1 set is hardware RS232, the other is software RS232) and I believe a third only RX or only TX pin. You can easily use them by adding a relay to switch between device 1, device 2 and device 3. Or make device 3 permanently connected and switch the other 2 with the first set of RX/TX pins. I had issues with the programming for communication with a web server.

EDIT:
normal practice is to use the nodeMCU to connect to the arduino through RS232 and the arduino to turn on/off what ever you need. This is done in modern devices from big manufacturers like smart AGVs.
 
EDIT:
normal practice is to use the nodeMCU to connect to the arduino through RS232 and the arduino to turn on/off what ever you need. This is done in modern devices from big manufacturers like smart AGVs.

I would entirely disagree, why add an un-needed Arduino when the nodeMCU already has loads more power than an Arduino and plenty of capacity - I would say it's certainly NOT normal practice.

The only sort of time you'd tend to do that is if you have an existing Arduino project, and you want to add WiFi to it, but you'd tend to use an ESP-01 rather than wasting an nodeMCU.
 
I would just use a Wemos mini (and relay board) at each node. They can all connect to your Wifi and communicate through that.

Mike.
 
I would entirely disagree, why add an un-needed Arduino when the nodeMCU already has loads more power than an Arduino and plenty of capacity - I would say it's certainly NOT normal practice.

The only sort of time you'd tend to do that is if you have an existing Arduino project, and you want to add WiFi to it, but you'd tend to use an ESP-01 rather than wasting an nodeMCU.
You are making an oppose my posts contest with me?
Yes its certainly so, the nodeMCU has about 10 digital I/Os and I have been working on those big company PCBs, so its exactly that inside. The atmel mega 2560 is added to have more pins.
 
Last edited:
Its possible, but a bit tricky. I have not used the Xbee, as for the nodeMCU the programming is not well documented and hard to find. The pin layout is ambiguous and you never know which pin you are activating until you test it. I recommend a microchip wifi module and MCU.

The nodeMCU has 2 RX/TX sets of pins(not confirmed: 1 set is hardware RS232, the other is software RS232) and I believe a third only RX or only TX pin. You can easily use them by adding a relay to switch between device 1, device 2 and device 3. Or make device 3 permanently connected and switch the other 2 with the first set of RX/TX pins. I had issues with the programming for communication with a web server.

EDIT:
normal practice is to use the nodeMCU to connect to the arduino through RS232 and the arduino to turn on/off what ever you need. This is done in modern devices from big manufacturers like smart AGVs.
Thank you all for response. Can you confirm what do you mean by microchip wifi module and mcu? I assummed that the nodemcu board has is a wifi module and a microcontroller 2in1.
 
I should tell a little bit nore about my project so it is easier for you to understand:
I have previously used the xbees before to remotely trigger the led from a distance.
My idea is to upgrade my previous project and add an ESP that would allow me to control a device through the web browser. I know that I can use the esp itself to control the device from web browser but the devices would have to be connected to microcontroller(or nodemcu) with wires. So by using an Xbee i should be able to do exactly thr same thing except i woulfd not need to connect a device with wire to microcontroller - instead, the coordinator xbee would send signal to router xbee and will turn on devices all around the house withour needing to do any cabling/wiring
 
Check the second link I gave you.

EDIT:
The nodeMCU or wifi module only connects with the router, on the other hand the router can connect to many wifi modules. There is no way to avoid the minimum wires or PCB traces to the relays and from the relays to the device. How the receiving wifi modules are controlled depends on your web server. Is that correct?
 
Thank you all for response. Can you confirm what do you mean by microchip wifi module and mcu? I assummed that the nodemcu board has is a wifi module and a microcontroller 2in1.

Microchip make some modules complete with processor and WiFi (or GSM/GPRS), but they aren't cheap, and I've never used one - although I've considered it..

And yes, the nodeMCU board is WiFi including a highly specified processor, much more powerful than an Arduino.

NsrMagazin - if you need more I/O pins than the nodeMCU provides, then there are many different ways to increase them - including using an Arduino to add extra pins, but using the far more powerful processor in the nodeMCU.
 
Check the second link I gave you.

EDIT:
The nodeMCU or wifi module only connects with the router, on the other hand the router can connect to many wifi modules. There is no way to avoid the minimum wires or PCB traces to the relays and from the relays to the device. How the receiving wifi modules are controlled depends on your web server. Is that correct?

Yes I would have a router xbee device that would trigger a relay and turn on device that way I can put a router xbee lets say 20 meters away from the microcontroller and I would not need 20m of wire connecting both of them.

I have also read the link, but with my given time deadline, i do not think I have enough time to teach myself another microcontroller
 
In that case the nodeMCU is usable. You will have to program it to receive from a web server and it can control up to about 10 devices.
 
Yes I would have a router xbee device that would trigger a relay and turn on device that way I can put a router xbee lets say 20 meters away from the microcontroller and I would not need 20m of wire connecting both of them.

Xbee is quite expensive, and do you need Xbee? - have you considered the simple HC-12 wireless module?, far easier to use if you don't need the networking capabilities of Xbee.

I've got a Wemos Mini (in fact I'm just altering it at this moment) with an HC-12, it interrogates four different remote modules with HC-12's and PIC's, these read the temperature and humidity, and the Wemos uploads the data to ThingSpeak.

The HC-12 is VERY easy to use, it's just a serial link, and the Wemos Mini is a smaller version of the nodeMCU.
 
Xbee is quite expensive, and do you need Xbee? - have you considered the simple HC-12 wireless module?, far easier to use if you don't need the networking capabilities of Xbee.

I've got a Wemos Mini (in fact I'm just altering it at this moment) with an HC-12, it interrogates four different remote modules with HC-12's and PIC's, these read the temperature and humidity, and the Wemos uploads the data to ThingSpeak.

The HC-12 is VERY easy to use, it's just a serial link, and the Wemos Mini is a smaller version of the nodeMCU.
I ve got 2 xbees so i thought i might use them. Il look into hc-12
 
This thread is becoming very complicated for a simple project.

The ESP32 or ESP8266 can both be programmed with ArduinoIDE and documentation is becoming better and better.
The project described above would need one ESP8266 to control three relays - so only three outputs are needed. If there is some distance between the three devices, I would use an individual ESP8266 for each (one output needed to run one relay on each ESP8266). No XBee,
1) just set up the remote controls with ESP8266 as Web Clients (or connect with your iPhone or other web brows
2) set up the ESPs controlling the relays as Access Point Web Servers.

You can find all the examples you want by googling: arduino esp8266 web client
Or, arduino esp8266 web server access point.

You can also configure them to connect to your home's network with hard coding of the network name and password, or use a setup procedure to have the user enter the network name and password, or hard code a non-internet connected dedicated network for devices to use. Every combination of connectivity is possible and you can even make one-the-fly changes to the setup in code.

The only issue is finding a relay that can be driven directly with the 3.3v and low current of the ESP or adding a switching Transistor between the the ESP and relay.

Now, if you really, really need the functionality of the standard arduino ARM chip and ESP32...
Finally, at CES in Las Vegas, Arrow Electronics was giving away the new Ardunio MKR 1010 which is a single board with USB connector and an traditional Arduino chip plus ESP32. Kind of a waste but runs existing Arduino code and has more than the single Analog input of the ESP8266. Note: This Arduino MKR even has a lithium battery charging circuit on board. I think they will retail for $35.50. I luckily ended up with a stack of them because my non-tinkering coworkers were willing to help me out.

**broken link removed**
 
@ gophert You are totally right, I just buy them cheap modules. I picked up 10 esp8266 E for a dollar each I haven't had the need to use a uno with one I used both the arduino ide and lua they both program them fine and work great.
I use it to turn on a lamp.
I over came the 3.3 volt problem with a 2n2222 and resistor plus a diode across the relay and I picked up some cheap wall supply that was 12 volt after taking them apart there board is supper small. I add a lm117-3 and 2 caps for the esp power and I'm good to go.

 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top