Solar volts and amps with 2 relays (sen0098 and nodemcu)

I am brand new on this
dfr ac/dc current sensor mod 50A
nodemcu 12e…

I need to view volts,amps and switch 2 relays on and off (one for charger when volts reaches 11.5v and the other to switch the load on and off at certain times
Igot my nodemcu to work thru blynk with the relays (basic) but that it so far and I am now stuck
please help me

Can you elaborate a bit more about what you’re trying to achieve?


I have my lights internet and tv connected to a 12v battey with a solar charger (when the battery did not charge enough by the sun ,then I have to manually connect an AC charger to it ,so that I still have tv lights and internet… lol.)
I have an nodemcu , sen0098 volts and amp sensor and 4 relay board with a 12v AC charger.
if I can
1 read the volts
2 read the amps
3 switch the AC charger (relay) on at a certain volt
with blynk , then I would be vary happy

You’d normally do this using a voltage divider made using two resistors connected to the analogue pin of the NodeMCU. However, as you’re using the NodeMCU’s single analogue pin for the SEN0098 this isn’t an option.
Alternatives are:

  • Find a DC voltage sensor that can be connected via I2C
  • Use an Analogue multiplexer to give you more analogue inputs
  • Switch to using an ESP32 board rather than a NodeMCU (possibly the best option with 4 relays as well, because you have a limited number of suitable pins on the NodeMCU)

Find some suitable code for the SEN0098 and give it a try. If the code is written so that all of the work is done within the void loop then this will need to be changed using a timer to call a function, then moving the code out of the void loop into this function. Test the sample code first then when you’re happy that it works share it here and we’ll show you how to add a timer.

Fairly easy when you have the voltage readings working. Figure-out if your relays are activated with a HIGH or LOW signal and the logic that you want to use and we’ll give you a hand.

Adding-in the Blynk part will be the last step in the puzzle.

One thing that you may not have considered…

As soon as you connect your battery charger, the measured voltage will go up. If your battery charger control logic is like this…

  • take a voltage reading every 5 seconds
  • ? is the voltage below 11.5v?
  • if Yes then turn on the battery charger
  • if No then turn off the battery charger

then you’ll have a problem because the battery charger will be turned on and off every 5 seconds.

One option may be to measure both the battery voltage and the output voltage from the panel. If the panel is generating more than 11.5v then the battery charger needs to be off.
This approach obviously needs a third analogue input, which is maybe another reason to use an ESP32.


1 Like

that is allot of things to fix up
tell me ,what about a INA219 dc current monitor ?
can that work with the nodemcu?
I can also switch the charger on at 11.5v and let it stay on for 2 hours (just to keep things going) my solar panels are big and this does not happen often , but it does sometimes . and when I am not at home people get mad at me.
Even if I can just get the volts with the INA219 and no amps it will be ok


But isn’t the INA219 designed to measure current, not voltage?


I don’t think so I found (Power monitor) in Blynk.Community and tryed to load the conde in arduino ide …but got a (settings.h not found…error)
where will I fix this ?
sorry for asking I am a bit new ,but why wont the other sencor work ,operation is 3.3v-5v ?

Post a link to the Power Monitor topic.