Go Down

Topic: ARDUINO WEB SEVER CONTROLLING 802.15.4 XBEE NETWORK (Read 1 time) previous topic - next topic

wkpedro

I bought for this project:



5 Xbee's S2C,
4 Xbee nanoshield
4 Arduinos Nano
1 Arduino MEga 2560
1 Xbee shield for 2560
1 W5500 Ethernet Shield

I will have a page hosted in Arduino 2560.
This page will have 4 buttons, this buttons pressed will send data to arduino nanos via Xbee 802.15.4 network.
Its a simple project to control led 13 in arduino nano.
Actually, this project will be controlling a house, spread in a house with xbees, relays modules, arduinos nano
Home automation project with xbee network basically
I would like to first setup this page working and controlling a few nanos then change a bit the project and add some features like IR for tv rooms and air conditioning, current sensors etc..
After this is done i will figure out how to work on the IOS app cause the android app i have done once and was easy using MIT app inventor

The main porpouse here is make a good conversation btw arduino mega and 4 arduino nano, with Xbee i can easly do that using the slave code for all arduinos but the master code needs the ethernet communication able all the time...

Can anyone help me start or give me good advices?


VonRansak

Perhaps if you had a picture or example of someone else doing what you are trying to do, it would elicit more response?  Show some more of your work.  What have you tried so far? 

Do you mean something like this?  https://www.youtube.com/watch?v=O-l934-rFOQ

If there is a particular 'application' you are looking for sometimes it helps to change the 'keyword' in the search.

wkpedro

VonRansak

I watched your video, is something like that yes.
Today i worked onthat project and everything went fine.

I setup 3 xbees 802.15.4 for chat in XCTU.
Then uploaded phisical pixel sketch to those 3 arduinos, and got them working
w5500 ethernet worked fine with xbee shield and arduino mega
3 boards together   

wkpedro

Hi, i've been working with that and with with some ctrl c ctrl v copied codes i got that.
I have 1 arduino mega which i call Master and a arduino nano which i call Slave, they both have xbees plugged in with an xbee shield, the network is 802.15.4(i choose that one cus it is easy to setup xbees with that protocol)

Here is the Slave code:
I got from a brazilian forum this code dont remeber where

I can send values from mega and nano would read and send data back but mega wont read back
The objective here is change values on page ON OFF


wkpedro

Actually, this project will be controlling a house, spread in a house with xbees, relays modules,  arduinos nano
Home automation project with xbee network basically
I would like to first setup this page working and controlling a few nanos then change a bit the project and add some features like IR for tv rooms and air conditioning, current sensors etc..
After this is done i will figure out how to work on the IOS app cause the android app i have done once and was easy using MIT app inventor

The main porpouse here is make a good conversation btw arduino mega and 4 arduino nano, with Xbee i can easly do that using the slave code for all arduinos but the master code needs the ethernet communication able all the time...

wkpedro

OK sorry everyone, i changed my code i believe it is more understandable now.
This is the master code, an arduino mega  hosting an web page that refreshs automatically , and changes the button value of a led in another arduino nano:



This is working for me, but i actually need the int "nano1led" to only change when arduino mega reads the arduino nano string telling him the led is on, so the button only send the command does not change the int, the int will be changed by the real state.. Any ideas?
i Am using the same slave code

wkpedro



This is the page in arduino mega with only one button to control arduino nano
The button changes "turn on" when off "turn off" when the led is on in the arduino nano with another xbee

SamirTafesh

Dear wkpedro,

I have read your thread, from what i understand, you are creating your own protocol and page to control your relays or other devices,
but why don't you try to make your home automation compatible with market standards and by this your configuration will be standard and all your devices can be connected, like your smart TV and any smart device you have, even the ones that you did not build.
Please have a look at OpenHab, it can communicate with almost all IOT devices
and for your own devices you can use HTTP or MQTT protocol
it has already Android and IOS clients, and it is simple to configure

Regards
Samir Tafesh
 

wkpedro

Dear Samir

Well, i read you advice, and it is not thr first time i hear about IOT devices
But when i bought this stuff i planned to do something, now i am kinda stuck in a coding problem, i dont know...
To be honest right now i just wanna put this thing to work, but i kinda feel this isnt worth time and the money(which i already wasted)
I think i am gonna need a Raspberry Pi  to work better with IOT devices right?

it has already Android and IOS clients, and it is simple to configure

I wanna make a costumized app for home automation, with the page i could use inline css and java maybe to get exactly the interface i want, and also would be the easier way to da that, i am really noob thats why i use these easy tools like xbee and arduino web server, i asked a few ppl in this forum and they said i could trust arduino for this use.

I will keep trying to make this communication when i get this house done i will implement this project with  market standards as you said.

Thanks Samir

SamirTafesh

Dear wkpedro,

Don't under-estimate what you have bought, they will do the job, i my advise i am guiding you to write your code respecting the standards, so after that you can integrate them in any home application.

xBee is not my domain, but  I understood that you have already create the communication between the devices, which is a good thing, and we can consider that you already did this layer.

for your design to work as you requested,
1- you should configure the Mega as Master device serving the internet and the clients (HTTP), also it should act as client to request actions from the client.
2- your client (Nano) should work as Client/Server at the same time
    a- client when the nano needs to communicate with the Master via (http) to update the state on the Web page
    b- server to receive the request from the Master, since it is orchestrating the dance, and the server (nano) will reply back to the client (Master).



Regards
Samir Tafesh


wkpedro

#11
Aug 29, 2016, 01:47 pm Last Edit: Sep 03, 2016, 04:45 am by wkpedro
Dear Samir
Thanks for your reply again, is good to have your opinion here

HTTP connection for all master and slaves would be a good way to finish this project i agree also,
But i would like to make this connection only in the master device, then it would control and get states by the xbee comunication, so i would only have to write simple codes to my slaves,

like this would work for the slave

I know another stone i would have to face after figuring this out, would be a way to make the slave keeps telling the master the led status, i think would be better for this project if the nano only keeps sending data when we have a client connected to the page.

Thanks Samir

wkpedro

#12
Aug 30, 2016, 10:07 am Last Edit: Sep 03, 2016, 04:44 am by wkpedro
Well i finally managed to mix the codes Samir

Thanks for the help anyway, this project now is working only ethernet master and slaves can be controlled by this page only with serial strings.
Now i will go to the next level, making the digital button switch, which will also send string to the master telling if it is on/off controlling the relays
There will be 1 master 4 slaves in this house, lets see how it ends, first i need to setup more slaves and work on the interfaces like android app and the page for begin...

wkpedro

This will be a slave with nano and xbee, still missing the relaymodule that havent came yet




Looks pretty normal in my wall, lets make it work now

wkpedro

#14
Sep 07, 2016, 01:45 am Last Edit: Sep 07, 2016, 06:28 am by wkpedro


Go Up