solarpowered MQTT ultrasonic level monitoring (JSN-SR04T), temperature compensation (DS18B20), seismic activity monitor (MPU6050 )

Thread Starter

huramentzefix2

Joined Apr 12, 2024
26
I need to monitor the level of potable water, stored in cylindrical 2000 litre plastic tanks.
This, I would like to achieve using a solarpowered ESP-12F via MQTT which should go into light sleep.
The ESP-12F has to supply power to the ultrasonic level transducer (JSN-SR04T), the digital thermocouple (DS18B20) and an accelerometer (MPU6050), collect the data cary out the temperature compensation and send it to the MQQT server together with the battery voltage.

  1. ESP-12F
  2. 3.3V regulator with capacitors
  3. Lithium Ion Battery
  4. ultrasonic transducer JSN-SR04T
  5. digital thermocouple DS18B20
  6. accelerometer MPU6050
  7. Solar panel 170mA 4.3V(VMP)
  8. Li-Ion battery 3.7V
  9. CN3065 Mini Solar Lipo Charger
  10. 1S 3.7V 4A 18650 Charger PCB BMS Protection Board
  11. Step-up to 5V for the JSN-SR04T
  12. NPN transistor switch
  13. MQTT

I was thinking that the ESP-12F can wake up and turn on the consumers and step-up board via an NPN transistor?
then collect data:
  1. time?
  2. distance
  3. temperature
  4. acceleration
  5. battery voltage
carry out temperature compensation calculation, send the data via MQTT and go back to sleep

The idea was to have the accelerometer on top of the water tank to monitor when the water mass gets into motion due to seismic activity.
The water should get into a detectable amount of motion when there is seismic activity. And even with the sensor in sleep I should be able to detect it after wakeup?
The neighbouring island (Puerto Rico) has about 10 earthquakes a day. I think we have around 10-20 a month.

Do I need a RTC or could it get the time via an MQTT topic it's subscribed to? Or is it enough using the time on the MQTT server once the data is being received?

Is there a way to secure the wifi password on the ESP-12F? HTTPS is probably not an option, so I can just set up an extra network with SSID and block MAC-adresses?
 

trebla

Joined Jun 29, 2019
550
ESP-12F can wake up and turn on the consumers and step-up board via an NPN transistor?
You can power up loads with NPN transistor if you use a regulator with inverted enable input. Another option is to use a high side switch. Disconnecting loads ground connections with NPN transistor is bad idea because it can possible disrupt the function some MCUs I/O pins.
 

Ya’akov

Joined Jan 27, 2019
9,267
Welcome to AAC.

You should start by characterizing your power budget so you can balance your activities against it. This can be constrained by supply or demand. You should start with the demand side by deciding on all the power consuming activities you need to do and working out what that demand looks like.

If the demand is regular and predictable that makes things a bit easier. But you will need to know how much peak power you will need, and the cumulative demand in terms of power/time (e.g: Wh). These things will let you choose the right PV panels and battery for your application.

If you’ve committed to a particular set of panels and battery—not a good thing since you really have no idea how much power you need—you will have to start by characterizing the capacity of that system.

The best way would be empirical and long term. That is, set up the panels/battery/charge controller system and measure it’s performance across a long enough time that all of the conditions you encounter across the yearly cycle will be tested.

This result is your power budget and now you have to scale your activities to that. You will have to characterize the cost of each activity and balance it against the power that will be available.

It is likely that if you have any reasonably good PV panel(s) you will be able to produce excess power during the day, and it is important that your battery be able to store as much of this as practical so that when the panels aren’t producing anything (e.g.: night, cloudy day) you have that power to use.

There are resources that provide information about average sunlight in your area and they will be important to refer to. Once you have some idea of available and required power, you can decide how careful you’ll need to be about things like MCU sleep and powering peripherals.

You might also choose to have adaptive behavior where the activities are scaled according to the supply of power. This might include processor sleeping, update frequency, local storage and batch notification, &c. where different levels of power saving actions are triggered by the conditions.

In any case, the random selection of panels, batteries, and power saving—blindly selected—is not the way to make a successful design. Creating your own constraints for no reason is sure way to make a mess of things. Being more rigorous will pay back manifold. It doesn’t have to be perfect, but you do have to do something to make sure there is a basis for your BoM.
 

Thread Starter

huramentzefix2

Joined Apr 12, 2024
26
@Ya’akov I very much appreciate your detailed axplanation. I should have mentioned it that this is not for a customer, it is a personal thing that I am doing for myself.
There is no herd of 3000 cattle depending on this water, so if there is no reading then this won't cause harm.
I understand that when someone is selling a solution like this to a customer, then you have to go through all your mentiones steps.
I have mentioned the equipment that I have and my questions are based on those.

I am not going to purchase anything else and would appreciate if you could focus on what I have in my box.
You made some valid points to adjust the frequency, hence consumption base on the available sun-light or the actual battery condition. Would you suggest making it based on battery voltage and rate of rise or decline or should I read the solar power via a shunt? What voltage drop is needed to accurately read the solar panel current?

You can power up loads with NPN transistor if you use a regulator with inverted enable input. Another option is to use a high side switch. Disconnecting loads ground connections with NPN transistor is bad idea because it can possible disrupt the function some MCUs I/O pins.
OK thanks, so it might disrupt the 5V input pin. I don't have to do it with a NPN transistor. That's why I am asking here to learn from you guys whether or not my idea is good or not. Suggest how I should do it and I will see what I have in my box to make it happen.
 

trebla

Joined Jun 29, 2019
550
Suggest how I should do it and I will see what I have in my box to make it happen.
For example: MCU Vcc is 3.3V and you want control 5V load with less than 1A current. Choose a LDO with enable input which has a reference to MCU Vcc level or can switch the LDO on at MCU Vcc level like the BA50BC0WFP regulator for example. Before you put the MCU to sleep, switch down the output pin connected to LDO regulator enable (CTL for BA50BC0WFP LDO) pin. This should work without additional transistor switch.
 

Ya’akov

Joined Jan 27, 2019
9,267
@Ya’akov I very much appreciate your detailed axplanation. I should have mentioned it that this is not for a customer, it is a personal thing that I am doing for myself.
There is no herd of 3000 cattle depending on this water, so if there is no reading then this won't cause harm.
I understand that when someone is selling a solution like this to a customer, then you have to go through all your mentiones steps.
I have mentioned the equipment that I have and my questions are based on those.

I am not going to purchase anything else and would appreciate if you could focus on what I have in my box.
You made some valid points to adjust the frequency, hence consumption base on the available sun-light or the actual battery condition. Would you suggest making it based on battery voltage and rate of rise or decline or should I read the solar power via a shunt? What voltage drop is needed to accurately read the solar panel current?


OK thanks, so it might disrupt the 5V input pin. I don't have to do it with a NPN transistor. That's why I am asking here to learn from you guys whether or not my idea is good or not. Suggest how I should do it and I will see what I have in my box to make it happen.
While I would like to continue with the design discussion there doesn’t seem to be much value in it, so I will desist.

As far as power availability and battery SoC, I would measure panel voltage and use a coulomb counter to track the battery.

Good luck with your project, expect to make several versions before something works well enough to be used.
 
It all rounds down to how often you want a data update.
A esp-12 with acelerometer an ds18b20, powered by a charged 18640 Li batt will last a cuple of mounth reporting every 15 min, as you may see at the iSpindle.de , a beer gravity monitor.
Don’t know how murch power the ultrasonic eat, but you may be good for a cuple of cloudy days.
SSL MQTT could be done on esp-12, you may check the Tasmota proyect.
 

Thread Starter

huramentzefix2

Joined Apr 12, 2024
26
thanks for the tasmota link, I have tested it a while ago but had no idea about all this.

these solarpanels are super small. I can just add a second one.
I meassured (with DC clamp) 170mA at 3.8V = gestimating pretty realistic 5 hours per day at this load (I live in the dominican republic so there is usually a lot of sun)
=3.2Wh/day.
So I might need a second or third panel. It would be nice to get some seismic activity ever now and then.

I will order the step-up-converter and then start wiring and return here.
thanks for all your help so far.
 
Top