1

Hej there,

I have a small project at home and I'm curious if people have some advice/idea for me. Because I'm not sure if the communication between the different devices is the way to go.

This is my current setup:

I have a Android application running on an Android device (tablet). This Android device can communicate with a MySQL server with a json/PHP. The Android device is receiving data from the database but also writing data to it. The MyQL/web server is running on a Raspberry.

The second device is an atmega328p microcontroller(http://www.ebay.com/itm/2-x-ATMEGA328P-PU-ATMEGA328-MICROCONTROLLER-IC-Free-Shipping-/280994585126) that is sending temperature/humidity to the MySQL server on the Raspberry. The ATmega is communicating through a 433 MHz chipRF(MX-05V). The Raspberry also has a 433 MHz chip RF(MX-05V) that is receiving this data and writing it to the MySQL server.

So actually the ATmega is communicating with the Raspberry and the Raspberry is communicating with the MySQL server.

It is working properly but I'm not sure if this is the way to go. So my question, what are you thoughts of this setup, what would you do different and why?

Thanks, Matthijs

  • 1
    A picture says a thousand words. I really don't know how to answer you question because I'm not sure what your setup is. Also people are going to vote to close the question because its not at all clear. Can you draw a system diagram and try and clarify what you mean by a 433MHz chip (I think you mean a radio, but...) If the Raspberry (or Pi for short) is running the SQL server then if the ATMega is talking straight to the SQL socket that is different to it talking to a daemon or app which talks to SQL. Hope that helps, give it an edit and I'll look again :) (I'm meant to say Hi but – Code Gorilla Aug 14 '17 at 12:24
  • I've run out of letters :) – Code Gorilla Aug 14 '17 at 12:25
  • 2
    If it is stupid and it works ... it ain't stupid! Though i see how you do it ive done the same some other way, ive used the ESP8266 to transmit the data to the cloud skipping the raspberry pi server and the android app just leaving a website to check the data. Not saying your suggestion is wrong. Just inspiration. – Magic-Mouse Aug 14 '17 at 12:35
  • @Magic-Mouse thanks for the responce. My raspberry also have a NRF24L01. This is similar to the ESP8266 i thinks. I use it to communicate with the Milight lights. – Matthijs Aug 14 '17 at 13:34
  • @CodeGorilla Thanks for responding, edit the text a bit. Thanks, going to add a classdiagram later. – Matthijs Aug 14 '17 at 13:35
1

If I understand correctly:

  • You have a Pi hosting MySQL and a web server.
  • A Mega writes temp/humidity data to the server.
  • An android device reads data from the web server.
  • The Pi and the Mega talk over a 433(MHz) radio?

Is it the write way to go? What you have is a tried an tested design, a central server responsible for collating at serving the data. My one concern is the 433 radios, I think you might be limiting the scalability of your design by using that. What happens if you want to add a second Mega to report a different sensor? You PI needs a second receiver and a second app to read, although the PI will handle 2, easily, there will be a point where it can't handle any more. I'd suggest that you look at technology that allows multiple nodes on the same network, WiFi.

You could use WIFI by either getting adding a WiFi device to you Mega or ditching the expensive Mega and buying a $2 Wemos D1.

But that's just my opinion, and unfortunately that's the reason this question will get closed, because asking for people's opinions is taboo.

  • Thanks for the responce, i tested it with 2 atmega's and this works properly. But i can agree on the fact that it can be limited when i want to add more atmega's. I need to test it to see if it still works with for example 5 atmega's. – Matthijs Aug 14 '17 at 13:28
  • But why spend $40 on a mega when you can spend $2 on an ESP and program it exactly the same way? – Code Gorilla Aug 14 '17 at 13:38
  • sorry for the confusion.. i mean the atmega328p microcontroller: ebay.com/itm/… – Matthijs Aug 14 '17 at 13:50
  • 1
    i.stack.imgur.com/Uq7w1.jpg on the right u see the atmega with a movement sensor, light sensor, temp and humi. On the left the same only in testing format. I do not know the esp8266. I will check it out. Thanks! – Matthijs Aug 14 '17 at 20:05
  • 1
    The D1 Mini NodeMcu looks impressive! Thanks for the inspiration! – Matthijs Aug 18 '17 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.