Logging voltages for weather sensors

Hi

I was informed that the Arduino Mega2560 could do what I want and wonder if that is so? If not, do you know of a system that will?

I am seeking to get some data loggers made up to collect weather data to provide a service to help get more weather stations in the area to help communities. I could buy a few units to provide several people with these.

I would like to be able to add weather sensors of my choice to the system and have it work like my current system which now uses old technology being a parallel printer port. A system that uses USB would be better.

Currently I have a system that samples voltages between 0 and 5 volts on 10 input ports and I have software that lists each voltage sample in a table in a text file containing 10 columns that can opened in Microsoft Excel and pasted into a file with formulas to calculate the values for temperature, rainfall, light, wind direction and wind speed. Currently, my software records the voltage from each input every half a second so that each hour there are about 7200 lines of data in the file. My current system can therefore sample data from 10 different weather sensors.

Are there computer programs already made to enable sampling the data like I am currently doing as explained above, and if so, what could they cost? Would it be easy to find or write a program to do this and do you know who could do it for me? I assume these would all work on Windows 7 and above.

I am also wondering if the the Arduino Mega2560 will wirelessly connect to a USB port of a computer about 100 meters away and if there is much more cost to do this?

Regards Richard.

If you have wifi you could use mega together with esp32 to collect your sensor data to cloud, for example to google sheets.

Do your sensors have to report results by means of a voltage? I assume that the need for ten A2D ports is what led you to a mega.

There are other sensors to consider - e.g. the DS18B20, which will report temperatures digitally.

Another possibility to open up the range of microcontrollers would be to use a dedicated board to take care of the A2D aspect, leaving the main device to read other sensors and report over usb or WiFi.

Interesting project but we are not a free design or code writing service. We will be happy help out with your design and or code but first you have to make an attempt to design it, write it, post it and explain what is not working properly.

If there is hardware it is always best to post links to technical information as there are many versions of the same or different items. Since we cannot see your project, my eyes are to weak, you need to post using the language of electronics, an annotated schematic, (best) or a clear picture of a drawing. Pictures never hurt. Frizzing diagrams are not considered schematics here, they are wiring diagrams, great for assembly lousy for troubleshooting.

No! You will need something to send the RF and something on the computer to receive it. If you go to WiFi it might be easier.

Hello

Thanks for your replies. Do you think the Arduino Mega2560 may be the best and lowest cost option to sample the voltages and also work with a program to what I need?

Anemometers output a frequency that can be converted to a voltage via another circuit. However, I wonder if the software could also easily make the Arduino Mega2560 sample the frequency directly without having to do this.

Does anyone know how long it could take someone to write a program to make it work the way I want or if there are programs already made up to do it?

I am not sure if there is any advantage for digital sensors or if they would be easier to make work regarding a software program that would need to be written.

I do not know about how to create the software or electronics.

Another option is to use a weather station currently on the market. However, they are either very expensive or mostly not flexible in the way I need to position the sensors and many low cost ones are not accurate. If you know of any that could be suitable, please let me know.

It would be good to have the temperature and humidity sensor at about 1.5 meters above the ground in an instrument shelter. However, I would like a grass temperature sensor that could be mounted about 2 meters away from the shelter. A rain gauge is best about 2 meters away from the shelter as well and its position would need to vary depending on the station location. If it is an exposed area without wind breaks, the gauge may be best near the ground. However, if there are trees that could block the rain, the gauge may be better about 2 meters above the ground. The anemometer and wind vane would need to be on a mast about 10 meters high. These may not be needed in some areas that are not exposed to the wind and not having them could save costs. A barometer sensor could be in the weatherproof box containing the data logger.

Regards Richard.

Hello Richard,

I don't understand the reason for converting the output of an anemometer to a voltage, doing so adds complication and reduces accuracy. You say the output of yours is a frequency that varies with wind speed, can you be more precise? Mine produces pulses, the rate of which increases with higher wind speeds. Even at the highest speeds the pulses are easily slow enough to be counted by any micro controller.

What is the output of your rain gauge? Mine is pulses, and I've not found ones that output anything else. Also easily counted by any micro controller.

DS18B20 is a popular digital temperature sensor that can be read by most if not all micro controllers.

All mine are read with D1 Minis, which are small, cheap WiFi capable boards based on the ESP8266.

If you don't know anything about electronics or programming you are going to have to start learning.

There are many projects on internet is just about that. Google "weather station arduino".

Before you start: choose your sensors, make sure they are compatible with your Arduino board. It will save your nerves and money.

I prefer to use analog sensors (sensors are connected via looong wires). You can use digital sensors if your connections are short (meters).

For the radio link I stick to SMS. But I do not log the weather data every half a second, weather does not change that fast.

SMS is the most reliable way to transmit data (point->point, point->multipoint), does not require Internet and have a persistent delivery retry as a bonus :slight_smile:

Hello

With anemometers I think you could define the output as either a frequency or pulse. There is info on the anemometer I have at http://www.scottech.net/maximum/ . I also have had a second hand Young Wind Monitor that used to work and would like to get another one. See 05103-L: Wind Monitor . It would be good if the logger could be made to directly read the frequency or pulses and display them in the column in the text file that corresponds to the anemometer. Other columns could contain voltages.

Years ago a man made up a counter circuit for my tipping bucket rain gauge. It counted the tips and converted the number to the voltage where each tip count increased the voltage by 0.02 volts. After 50mm of rain when the voltage reached 5 volts, the counter reset and the voltage went back to 0 again before increasing again. The count or voltage would have to be listed in the column in the text file that corresponds to the rain gauge so the number can be converted to the rainfall figure in Microsoft Excel.

I sample every half a second because some wind gusts do not last long and if the interval is longer, the maximum wind speed could be missed.

With digital temperature sensors, would they give an output number that is proportional to temperature that could be displayed in a column of the text file where the number could be converted to temperature like I do now?

Could SMS work well for my purpose with a Arduino Mega2560?

Regards Richard.

With the one being suggested, no. It reports the actual temperature in Celsius or Fahrenheit. There are Arduino libraries that make it easy to extract that data.

They look good! However, I've not seen one like that so difficult for me to be helpful, sorry.

I count tips directly, converting to a voltage just seems daft. I use a 32 bit integer, which is never going to overflow in my lifetime! It gets reset to 0 if the power goes off, for example if I re-program the ESP8266 for some reason or if the power actually fails. I use a 15 minute resolution and display rainfall in mm per hour, so the difference between the count now and the count 1 hour ago gives the rainfall in the last hour, updated every 15 minutes. The count itself is incremented every tip.

See https://cdn.sparkfun.com/datasheets/Sensors/Temp/DS18B20.pdf
Typically you get 2 numbers, one is whole degrees C and other other is fractions of a degree C.

Hi

I am not sure if digital temperature sensors or the method you use to log rainfall will work with Microsoft Excel or any software needed to produce archived graphs like below.

I prefer software to graph out the measurements and keep a record of the graphs indefinitely in an archive. Only one weather measurement per graph is better. Some software programs graph out different measurements like wind speed and temperature on the one graph and it is confusing. However, temperature and dew point temperature could occur on the one graph and average wind speed and maximum wind gusts are good on the one graph. I prefer a graph with darker grid lines for every 5 degrees Celsius and lighter lines for every 1 degree. Many do not contain the lighter lines and it makes it harder to get an accurate reading. Please see an example of my existing charts at graphs and !monthchart 11-09 12-09 . Graphs could be joined. However, the reset times for the measurement need to start at 9AM for most records like rainfall and temperature. Graphs in many software programs go from midnight to midnight which is not good because the rainfall totals and temperature records do not match the BoM records. Graphs are best labelled with either maximum/minimum measurements or the accumulated rainfall for the 24 hour recording period starting from 9AM. It would be good to offset and calibrate the readings in the software so the sensor readings match the readings of very accurate instruments. To do this, accurate instruments like the BoM use could be placed beside the sensors and the software calibrated to the readings of the accurate instruments. I am wondering if there is any software that enables what I describe above? My graphs are generated from Microsoft Excel. But, it can be time consuming to manage and also correct and delete false or missed readings. A table or graph of daily totals over the months would also be of great benefit.

Regards Richard.

Of course they will work, why wouldn't they? You might have to do some minor changes to the data format to get what you need, but that would be trivial.

What do you mean keep the graphs? Graphs are just a way to display data, you keep the data and generate the graphs when you display it.

If you keep continuous data you can display it with whatever start and end times you like, you can make that user selectable when viewing the data. I keep one week's data and display the previous week up to the present moment, with the boundaries between days set according to whether we are using GMT or BST. The data is stored referenced to UTC. Only when the display is generated is the decision made to use GMT or BST.

Hi

What software do you use and do you have a webpage you can send me a link to so I can see your graphs? It would be good to archive the graphs for years so people can click on links to view past data.

Regards Richard.

My graphs are displayed on a Nextion display, not a web page. However, the principle is the same, keep the data, draw the graph on demand to display it. My graphs are generated by C code I wrote running on a microcontroller.

Excel, as I think you know, has its own graph creating capability, getting it to graph your data should be possible.

Hi

With your setup can other people see the data? I thought of putting mine on a webpage so it is user friendly for anyone to see.

Do you also think D1 Minis ESP8266 could work better for my purpose than Arduino Mega2560 or is there a better system again? I thought it would be best to have at least 10 analogue inputs. I could not see this on the D1 Minis ESP8266 I looked at or do you know one that is suitable?

Regards Richard.

Hi Richard,
My setup does not display on a web page, it displays on a Nextion like this one:

It is connected over a serial port.

Here is a 10 D1 Minis

Note how cheap they are.

You can run a web server on a D1 Mini, but I've never tried. The downside to them is they are fussy about how they are connected, in the sense that if you put the wrong voltages on some of the pins then they don't start up when they are powered. They have one analogue port. If you want to know more search for information about them. I've had quite a few, written lots of code for them and learnt a lot, but never learnt how to make a web server on one.

If you want internet access I suggest something RP2040 based, either

Note all the stuff it comes with, which might or might not be what you want.

I have 2 of these:

It doesn't have all the extra stuff the Nano RP2040 has, which is reflected in the price.

The Mega is not internet capable on its own, you need an Ethernet card for it. Even with that I'd say it's not ideal, as I don't think it has the processing power for much internet related stuff.

I'm failing to understand why you need so many analogue inputs. Most of the devices you want to connect don't need them. Not sure about the anemometer, I'd be happier with one that has pulse or variable frequency output rather than variable voltage. Easy to count pulses or frequency, variable voltage is going to be a bit less consistent to the speed of it.

I get the impression you have no experience with any of this, that being the case buy some kit and start experimenting, I'm fast running out of things to tell you on a theoretical basis.

Be careful with this - do you intend to run your website locally and open your firewall to the world?

Hi

I have had a weather website for years and many others have with no worries about hacking. I want to convert the graphs into a browser friendly format and keep archives of them online for people to see for years. I did it in PNG files before when my weather computer was running automatically before the hard drive failed. I want to set it up again.

Currently I have been using LM335Z temperature sensors which are analogue and I also have a light sensor that works off a light dependent resister to log light and sunshine which would be analogue. I could convert to digital but I am not sure how the values would appear in the text file table that could be pasted into Microsoft Excel.

I assumed that the logger board I use would connect to a computer and the computer would then upload the text file generated by a ftp program. I have software that would enable this to be done automatically maybe ever hour. Another computer maybe at a central location could download the text files and process the data by automatically pasting the text files into an Excel file with formulas to generate the graphs that would later be uploaded by an FTP program. I want to get a board that would be easier to make up and get programmed for my purpose.

Sorry I do not have a lot of experience with electronics or programming. I am trying to accomplish a lot of projects to help communities and people around the world and therefore I do not have time to learn about how to program these systems. Therefore I am seeking someone to make one up for me and program it and I can pay them for their help. I could then get someone else to make more of them up if the person making the first one cannot make more. This would create a network of weather stations in the community and make very interesting data comparison because weather varies incredibly over a very short distance in my area and it would make an interesting study. Other communities may be able to do something similar if I can get it to work well.

I thought a board with analogue inputs would be more flexible. I also wonder if analogue temperature sensors could be more accurate because the LM335Z sensors are usually within about 0.3 degrees Celsius of the true temperature.

Based on what I suggested here and in past replies, do you think the Arduino Mega2560 could be easier, faster and more cost effective to make up and program than other systems like D1 Minis ESP8266 or is there another logger that could work more effectively and be easier to make up and program.

My anemometer outputs frequency which I have been converting to voltage. However, this may not be necessary if a board could be made up to read the frequency or pulse on the input that the anemometer connects to.

I would also like to have a look at your graphs of weather data if you can post an example on the forum or better still give me a link to where I can view them.

Regards Richard.

I have a site that collects data from a couple of sensors in the house and also pulls from a weather service and the local airport to tell me what is going on outside. There are a few web pages that show historical data back a month and it stores data forever in a SQL database, even though there is no way to display most of it.

It used to be accessible from outside my electronic domain, but I locked the door after checking my logs. Almost every hit was someone trying to hack in and there were tens of such hits daily. Fortunately, most of the attempts assumed that I had a PHP site running on a windows machine, neither of which were true. Nonetheless, I shut down access before (I hope) a more canny attacker came along.

If the site runs on an Arduino or its descendants, I can't conceive of a way to hack it - the device has no OS and no way to run commands that an attacker injects. Nonetheless, you have to poke a hole in your firewall to permit access and that can be risky if you don't know what you're doing.

If you do anything sensitive on your local network (banking, email) I'd be very cautious about running a public facing website there without making your own DMZ, or better yet getting some knowledgable person to do it for you.

I'd be more inclined to pay AWS or Azure or GCP to keep that stuff in the cloud.

I can. Unless you write your own web server from scratch, right down to the hardware, then you are running open source code that anyone might have found a way to hack, no way to know if they have. They can then just run an automated scan looking instances of that server.

You might know I used to install telephone systems, we found some Panasonic systems would fail because the SIP trunks required a port to be forwarded on the router, the port was being spammed and the Panasonic system couldn't cope with the crap being sent to it.

1 Like