Advice on designing a SD+WiFi+LCD project

Hi all,

I'm relatively new to Arduino projects, and would like to ask for advice and recommendations regarding what board/shields/units to get for a project I am starting to build.

What I want my project to do is:

  1. Read data from several (probably 4) sensors. The sensors will probably be 1 meter away from the Arduino
  2. Store the readings on SD card
  3. Send the readings over WiFi
  4. Display the readings on an LCD screen.

All this for a month or two.

The simplistic idea would be to have an Arduino (Uno?) stacked with SD/WiFi/LCD shields, and connected to an external 9V battery.
However, from the little I already know, I reckon I will most likely encounter some issues with that regarding power consumption and/or pin requirements. Plus, it will become rather bulky.

So am I going in the right direction here or is there a better implementation?
Should I use a board stronger than an Uno?
Should I opt to use specific, minimalistic parts for the different components or should I prefer using shields? Are there any shields that combine all/most of the functionality I'm looking for?
Is a 9V battery source enough for such a project?
Can I use standard wire cable (24 AWG) to connect the sensors or are there any special considerations when I need the signal to travel 1 meter? At what distance is does it become a consideration for the signal received?

Thanks in advance,
Maor

You could use an ESP8266 instead of an Uno. Take a look at this data logging example I wrote. The advantage is that the ESP8266 consists of a microcontroller, a WiFi transceiver, and flash storage, all in a single package. This means that you don't need an Arduino nor an SD card.

You can use the sleep functionality of the ESP to run it off of a battery for quite a long time.
At what interval do you plan to log the data?
How much storage space do you need? On the ESP, you can save up to 3MB (that's a lot if you're just saving sensor values).

You can use an I²C display to save pins.

What kind of sensors do you want to use?
If your sensors are analog, you'll need an external ADC or a multiplexer.

I'm not a huge fan of stacking Arduino shields, most of them use some of the same pins.

Pieter

more data needed :
your sensors are a meter away ? what sensors, how much power, wired or wireless ?
you will not power most displays for months, but might get some like the nokia 5110 to come on briefly with a button press

esp8266 has wifi and you can put that into sleep and upload once a day, or with a button press.

how much data ? you could save to memory, if your volume is not too great.

also, you did not say how far away the wifi is. you might be able to send with a much-much less power consuming means to a plugged in device that has wifi.

for power, can you plug in ?
can you use solar to charge batteries ?

Is a 9V battery source enough for such a project?

Not the PP3 block batteries -- they will work for only a few minutes, if at all.

A project that is to run continuously for a month needs a very reliable power source, which can be quite a challenge if household AC is not available.

Andreas Spiess got an ESP8266 to run for 400+ days off of two AA batteries, posting sensor data every hour:

Pieter

PieterP:
Andreas Spiess got an ESP8266 to run for 400+ days off of two AA batteries, posting sensor data every hour:
https://youtu.be/IYuYTfO6iOs

Pieter

I'm glad you posted that. Apart from the technical aspects (including the HT7333 regulator), I love to hear the English language spoken with a Swiss accent :slight_smile:

Thank you guys for all that feedback. I'll try to clarify some more:

The project I'm trying to design is to measure temperature from several LM35 thermometers. Wired, naturally.
I want to be able to know the current temperature, thus the LCD.
I want to store the data for the duration of its work, thus the SD card.
And I want to be able to access this data remotely while the system is running, thus the WiFi, to transmit it to a remote logging server.
In case I have WiFi connectivity issues, I will have the SD card data available when done.

I am not sure yet how often I will sample. It will most likely be once an hour, but I will probably need a few runs to figure out what's the best time interval for me. I may reduce the interval, in the most extreme case it will be once a minute but I doubt I'll get there. It will, however, be a constant interval i.e. once the system is activated, this time interval will not change.

PieterP:
You could use an ESP8266 instead of an Uno

Was thinking about that, as I have one of those, but wasn't aware of the flash storage. I'll read more about it and how to use it, and see if it gives me easy enough accessibility for the data once I'm done. If not, I reckon I can stack a data logger shield on that, and connect the LCD using I²C, right?

If your sensors are analog, you'll need an external ADC or a multiplexer.

Would I need that for LM35s? If so, why is that?

dave-in-nj:
also, you did not say how far away the wifi is. you might be able to send with a much-much less power consuming means to a plugged in device that has wifi.

Not sure I understood this fully. Did you mean connect the Uno/ESP8266 to a router, or a WiFi hotspot, using ethernet? Or was it something else?

for power, can you plug in ?
can you use solar to charge batteries ?

Most likely, most of the time I will have a power outlet to plug in to. But there will be some cases where I will probably not have access to one. In such case, if I will have power limitations I will probably also limit myself to SD card only in most cases, but I would still prefer to have the WiFi option if I can make it work.
Solar is probably not going to be an option in such a scenario.

PieterP:
Andreas Spiess got an ESP8266 to run for 400+ days off of two AA batteries, posting sensor data every hour:
https://youtu.be/IYuYTfO6iOs

I don't have the time to watch the whole video, but from what I saw, quite an interesting source of information. I will definitely check out this video as well as his other videos.

And yes. Swiss accent is nice :slight_smile:

Once again, thank you all, guys.
Maor

+1 for the esp8266 idea. No Uno, no logger shield.

I use Wemos D1 mini for my sensors. I power them using li-ion batteries. A 4,200mAh 18650 size battery will power the circuit for probably 3 months with a 15 minute sample interval. I do not attach displays to them. I have created a Web page to view the latest readings on my phone.

Use ds18b20 digital temperature sensors instead of lm35 so that only 1 digital pin is needed to read all of them. Lm35 is an analog sensor which would need one analog input per sensor and esp has only one analog input. So for lm35 you would need an external adc module such as ads1115 (i2c) or an analog multiplexer (which would require the analog input and 3 or more digital outputs). Ds18b20 are cheap, accurate and much easier to use.


I apologize for the long delay in response.
Weekend projects require free time on your weekend... :slight_smile:

I will probably use the esp8266, but I don't think the mini will cut it for the project. Good to know about it, though.

I ordered some ds18b20 sensors, will play around with them a bit and see. I read somewhere that they are a bit more slow and complex to use, will test this part.

Loved the pics, by the way. And it also made me realize I didn't really think about packaging.
I apologize for yet another noob question: that board you used there - that's called a pref board, right?

I will probably use the esp8266, but I don't think the mini will cut it for the project

Don't let the word "mini" fool you. It may be small but it has everything any other esp Dev board has. Specifically why do you think it won't be up to the job? What do you need you think the Wemos won't provide that other esp boards have?

that's called a pref board, right?

You mean "perf", as in perforated. It's a type of perf board, yes.

With traditional perf board, none of the pads around each hole are connected. You need to connect them by bending component leads or connecting wires and soldering across the gaps. At the other extreme you have strip board. With strip board, entire rows of holes are connected together. This makes it easier to connect components together, but you have to cut the strips where you don't want further connections, using a special tool or 5mm drill bit to sever the strip, which takes up space.

The type I prefer are more difficult to find and they are a compromise between perf board and strip board. It is called tri-pad board. It's like strip board but there is a break in the strip after every third hole.

PaulRB:
Specifically why do you think it won't be up to the job? What do you need you think the Wemos won't provide that other esp boards have?

I do think it's pretty much similar to other boards.
I have looked into using the flash memory, and I don't think it will be convenient enough for me. I am taking into consideration a no-wifi environment, so I will have to use some sd card for it.
Since I already have a "regular" esp8266, I am probably going to use a data logger shield that should provide sd card support as well as a time mechanism.

What I want my project to do is:
3. Send the readings over WiFi

I am taking into consideration a no-wifi environment

Perhaps you could clarify. Will there be WiFi sometime/occasionally for the sensor?

maor:
I have looked into using the flash memory, and I don't think it will be convenient enough for me. I am taking into consideration a no-wifi environment, so I will have to use some sd card for it.

In what sense is an SD card more convenient?
The code to write to flash memory is exactly the same as the code to write to an SD card. But an SD card takes up extra pins, extra space, it's slow, and it draws a considerable amount of power.

SPIFFS.begin();
[...]
File tempLog = SPIFFS.open("/temperature.csv", "a"); 
tempLog.print(timestamp);
tempLog.print(',');
tempLog.println(temperature);
tempLog.close();

That's all the code you need to data log to flash, it's not going to get any more convenient than that.
And 3MB can store up to several years of temperature data.

maor:
Since I already have a "regular" esp8266, I am probably going to use a data logger shield that should provide sd card support as well as a time mechanism.

You don't need a data logger shield, you can just connect the SD card to the SPI bus directly. You just need an SD socket, or a Micro SD adapter, and solder some wires to it.
If there's a WiFi signal, you don't need an RTC either, you can just get the time from the network using NTP. This is demonstrated in the example I linked to in my first reply.

Pieter

Thank you guys for the quick responses.

PaulRB:
Perhaps you could clarify. Will there be WiFi sometime/occasionally for the sensor?

In most cases, I am assuming best case scenario, i.e. stable power source and wifi available.
I will possibly also have situations where I am using it when I have no power and/or wifi, so I want to try to build something that can support this too.

PieterP:
In what sense is an SD card more convenient?
The code to write to flash memory is exactly the same as the code to write to an SD card. But an SD card takes up extra pins, extra space, it's slow, and it draws a considerable amount of power.

Main convenience would have been to simply take the card out and plug it into a card reader to access my data, rather than dismantling the arduino and uploading a new sketch to read the data. Again, considering the no-wifi scenario.
Since I am not taking readings in high speed, then read/write performance is less of an issue. The power issue however may be something to consider indeed.

maor:
Main convenience would have been to simply take the card out and plug it into a card reader to access my data, rather than dismantling the arduino and uploading a new sketch to read the data. Again, considering the no-wifi scenario.

You don't really need to upload a new sketch, you can just connect to the ESP over WiFi directly (i.e. it acts as an access point, so there doesn't need to be a WiFi network available) with your laptop/phone. That's even faster than having to take the SD card out, and you can do it during measurements.

An ESP8266 (without USB-to-Serial chip etc.) draws about 90mA on average. An SD card will draw between 10mA and 50mA (some are rated up to 200mA during write/erase). That's an additional 10-50% increase in power draw.

Pieter

A Wemos will draw around 150uA in deep sleep. A "bare" esp even less. This means you can run them a long time on batteries. If you attach an SD card reader, you will have to find a way to shut it down when the esp is in deep sleep, otherwise battery life will be dramatically reduced. This can be done, but it makes the case for following Pieter's suggestion even stronger.

Another approach to the no-WiFi use case would be to visit the sensor every few days and put your phone into WiFi hotspot mode. The esp could then connect to that and transmit the data stored in its flash memory to a remote database over the phone's 2G/3G/4G connection.

But a revolution is starting for battery powered remote sensors. It's called LoRa and it can transmit data to base stations over several kilometers or hundreds of meters even through walls using a very clever radio system. It's already quite cheap and you don't need any special licence.