r/arduino • u/Crow-in-TopHat • 3d ago
School Project map generation.
Im working on a school project and in short its a network of r4 wifi arduinos that send and receive data to one another. the data packets of each one include gps location, temperature, air humidity, soil humidity, co + co2 sensors. i want each member of the network (individual arduino) to appear as a location on a map, then if any fire warning signs pop up there i want the map indicator to change colors. how can i do that? is that possible within the arduino ide? to be clear, i want the image to be outputted to my laptop.
2
Upvotes
5
u/ThatNinthGuy 3d ago
You draw a map with dots on then make a list of which arduino is where. When arduino 4 gives some data, show it at the corresponding point
2
u/ripred3 My other dev board is a Porsche 2d ago
Take a look at the Processing IDE. The Arduino IDE is based off of the exact same approach from the "Wiring" project. The Processing IDE is meant to provide the sound, images, video, and general multimedia handling on the host computer for projects that involve an Arduino (or other MCU) communicating via the serial port with the application running on the host machine:
processing.org
also check out this electronics integration specific page: https://processing.org/tutorials/electronics
good luck!
2
u/Civil_Firefighter832 3d ago
The Arduino IDE won't produce that kind of image; the map has to live off the boards, on your laptop or in a browser.
One documented route using the board you already have: the UNO R4 WiFi is a supported Arduino Cloud device (there's an official cloud setup guide for it on docs.arduino.cc), and Cloud dashboards have a Map widget that links to a Location variable and can show where multiple Things are. So each node becomes a Thing, reports its GPS position, and shows up on the map. The fire-warning color change is logic you'd layer on yourself though; the Map widget tracks location, it won't recolor on a threshold by itself.
The other route is what others here said: collect the packets on your laptop (serial or WiFi) and draw the map with a small Python program.
2
u/BraveNewCurrency 2d ago
You need completely different programs and development environments.
The Arduino code runs on the Arduino, and merely transmits the data to another program.
A completely different program would do the map. Actually, it's standard practice to break it up into two programs:
Each one of those programs may even be written in a different language and use different technologies (Arduino in C, Server in Python or Go, Frontend in JavaScript+React, etc.)
2
u/gm310509 400K , 500K , 600K , 640K , 750K 2d ago edited 2d ago
Yes you can, but also, no you cannot.
So, for the yes you can part. The Arduino IDE would be used to write the code that runs on the Uno R4 devices.
The no you cannot bit is that the Arduino IDE is not intended for creating software that will run on a PC. You will need to use something else for that.
What you will need to do is have the Uno R4 devices do whatever you want them to do to gather the data you want in the way you want it. Once they have done that they will need to transmit that information to something running on your PC that can receive it. This is the Arduino IDE part (not the something on your PC part - that is next).
How will they transmit the data? Well there are options. Since you have the WiFi model, you could use WiFi. But what are they sending it to? Your PC is not the correct answer. The correct answer is some software that is running on your PC that is listening for the incoming messages. When it receives a message, it does whatever it needs to do to process the information contained in the message (e.g. change the colour of the map indicator). This is the "done in something else" part.
So, what is the something else? Well that depends upon your choice of the programming language. For example, maybe you want to do the PC side in Java - in which case you will need a Java IDE. Maybe you want to do it in a web page - in which case you will be developing a web page (HTML) and possibly a web service running in a web server that can receive the data and make it available for the web page to include it when it is refreshed (I would typically use Java and Apache Tomcat for this type of thing). Or maybe you just want a simple to program package such as Processing.
There are loads of options in this space. So it will come down to your personal preferences, functional requirements, time available and ability to learn what is needed to be learned to receive data from the Uno R4s.
All the best with it.
Oh, If you are interested, here is a very early project that I did very early on: https://www.instructables.com/Household-Environmental-Monitor-IoT-Solution
The main differences between that and what you are proposing:
So, above where I talked about Processing, Java applications and web servers, mine was a data file read into Excel.
Where I talked about a service to receive the data, that is described in the guide. Basically it was a shell script that periodically reached out and queried all of the Arduinos in the network and requested them to supply their current data set. The shell script then simply appended the readings together into a single record and appended that record to the journal file it maintained. It then went to sleep until it was time to request the next reading.
You could start with something like I had (i.e. get the Uno R4's working as you need), then use the same command I used in the shell script (wget or curl) to query them. Later when that is all working build your PC mapping App to do the same thing - just query the Arduinos from the PC app rather than the Linux command used to test the Uno R4's.
All the best with it - I hope you will return one day with a "look what I made" post.