Read the statement by Michael Teeuw here.
MagicMirror and adruino over ethernet
-
@sdetweil if u want to send requests (in code) to the arudino web server, its just a the nodejs request library
see https://www.npmjs.com/package/request
you could use my sample module. https://github.com/sdetweil/SampleModule
there are also modules that will show ae existing page, MMM-IFrame -
Arduino sends data formated as simple HTML page. Pure text.
-
Thank you!
I’ll need some time to digest all the info you have provided. :smiling_face_with_open_mouth_cold_sweat: -
@Kereknjek no problem… come on back, there is all kinds of help around
-
@sdetweil said in MagicMirror and adruino over ethernet:
@Kereknjek I would see this module… MMM-ArduPort and how to send data from the arduino to the pi via serial
I also had added an http server to my arduino ESP8266 NodeMCU and provided apis for data access as another route, which keeps the devices from having to be physically wired together
Your MMM-ArduPort module looks EXACTLY like what I had in mind!
I’ll give it a detailed examination. :D -
I think that this is way to extensive for my knowledge. I can’t make heads or tails out of it…
-
@Kereknjek basically the arduino sends text strings with Serial.println(“[COMMAND:NAME:DATA]”)
To transmit a sensor data to the module: `[sensor:SENSOR_NAME:SENSOR_VALUE]**
Example:
Serial.println(“[sensor:MQ2:19]”);
Serial.println(“[sensor:LM35:11]”);
Serial.println(“[sensor:HCSR04:64]”);but anyhow, lots of work in the arduino code to make this work
-
@sdetweil
That part is perfectly clear.Here is C/P of what I am using now:
client.println("< !DOCTYPE HTML >"); client.println("< html >"); client.print("Napon panela: "); client.print(PanelU); client.println(" V < br/>"); client.print("Struja panela: "); client.print(PanelI); client.println(" A < br/>"); client.print("Napon baterije: "); client.print(BatU); client.println(" V < br/>");.
.
.
client.println(“< / html >”);That is slightly modified ethernet server sample program from ethernet library.
Edit: had to add spaces because html wasn’t showing.
-
This may be a stupid question , but . Why not just use the MMM-iFrame Module since the information is already provided /served from a webserver within the Arduino? You can change the size of the iFrame that displays the Url so that it can be small and take up just a little of the magic mirror or large and fill the mirror. Since you will not be touching the screen to change or interact with the data.
-
It’s not stupid question.
If arduino serves webpage, it should be served from sd card.
To use sd card, you have to use sd card library, make decisions wether client wants whole web page or just data packets…
All that takes a lot of memory and time to process. And arduino is slow and low on memory compared to RPi.
For arduino is much simpler to detect “give me data” and send sensor ID and value.Plus, in my case, arduino mega has 16 amperemeters to read and 18 outputs to regulate.
I wouldn’t like it if it gets stuck in code while inverter is working at full capacity. It could become fire hazard. -
@Kereknjek So in a nutshell. Yes the Arduino can serve a whole webpage of data , but it will take a long time. If one just sends the data from the Arduino to the Raspberry Pi then the Raspberry Pi can display the webpage faster as its processor and potentially memory is faster.
-
Yes. Plus, if I would want to make any modifications to webpage, first I would have to shutdown arduino and whole solar system, pull sd card out, modify page, plug sd card back in and restart sytem.
If sd card gets damaged in any way or get slow for some reason (had one like that on my 3D printer), whole system running on that arduino gets slow and unuseable.
-
@Kereknjek cool. You could make a little change and have it return just data.
If the path is sensor1, send just sensor1’s data. Etc.
Pretty easy, just a case stmt… you could make it json data pretty easy too…
The request could ask for a sensor or block of sensors, and send raw data.
-
On my Arduino measuring water flow and water volume. I did those in interrupt and timer routines. And sent data in the main path.
-
@Kereknjek Sounds like you need to backup the entire SD Card of your Arduino and create an image for safe keeping. If you Download Win32 Disk Imager you can create an image of the entire SD card and write it to a hard drive. Then if catastrophe strikes simply remove the SD card and use Win 32 Disk Imager to write the working image back to the SD card.
It can be downloaded here Win32DiskImager
-
@BD0G my 8266 has onboard flash ram. No SD card required.
-
@sdetweil Was referring to @Kereknjek and recommending he backup the SD card on the Arduino that is working for safe keeping.
I have an 8266 as well ! Its dedicated to my smartblinds control that I control via smarthings and a custom 3 D printed enclosure for a servo that mounts in the top rail of the blinds. Works splendidly!
-
@BD0G I agree, backup is an important strategy. I found out the other day SD cards have a limited life, determined by number of writes…
-
@sdetweil said in MagicMirror and adruino over ethernet:
@Kereknjek cool. You could make a little change and have it return just data.
If the path is sensor1, send just sensor1’s data. Etc.
Pretty easy, just a case stmt… you could make it json data pretty easy too…
The request could ask for a sensor or block of sensors, and send raw data.
Yes! That is what i’m looking for.
But discussion went to arduino side.
My problem is that I don’t know how to do it at magic mirror side. -
@Kereknjek ok. More later. Grandson on site!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login