No video

Building a 12v Car Battery monitor for Home Assistant with MQTT, NodeMCU, Tasmota, ESP8266, Arduino

  Рет қаралды 13,436

Mr 12v

Mr 12v

Күн бұрын

Here is a template example for home assistant as requested
- platform: template
sensors:
battery_v1:
friendly_name: "Voltage Monitor 1"
unit_of_measurement: 'volts'
value_template: "{{ ((states('sensor.voltagesensor1_analog_a0')|float - 45 ) / 1024 * 3.3 * 5)|round (2) }}"
I couldn't find anything on the market that would monitor a 12v battery and let me integrate it into Home Assistant so I could monitor the state of the car battery when its in the garage. I decided to have a go at making my own using a NodeMCU ESP8266 board that is flashed with Tasmota, an Arduino Voltage sensor and a 12V to 5V DC-DC converter. I also designed a case for it and 3D printed it out. overall it works great.
Components were sourced from Ebay but are readily available on the internet for relatively little money. I think the whole project was done under £20. This can also be done much cheaper if you broke it down into single components and soldered them all together.
I flashed the NODE MCU using Tasmotizer and a USB lead from the PC straight into the unit. It was very straight forward, I used the Sonoff Basic firmware and then configured it to a generic module. There are loads of tutorials on the internet about doing this but if you are stuck with anything please just ask.
Home Assistant configuration is shown later in the video, this assumes you have Home Assistant setup and working on your network, if you dont you should take a look, its brilliant!

Пікірлер: 32
@TheTox1cant
@TheTox1cant Жыл бұрын
anybody ending up here and looking at the posted template above here is some modified code to work with current HA as of 10/18/22 for both legacy code and modern. This code is using an ESP32C3 so you may or may not have to add back the 5v conversion Modern template: - sensor: - name: "Battery Monitor" unit_of_measurement: "VDC" state: > {{ ((states('sensor.voltage_monitor_1_analog_a1')|float(0) - 45 ) / 918 * 3.3)|round (2) }} Legacy sensor: platform: template sensors: battery: friendly_name: 'Voltage Monitor 1' unit_of_measurement: 'VDC' value_template: "{{ ((states('sensor.tasmota_analog_a1')|float(0) - 45 ) / 918 * 3.3)|round (2) }}
@thedmr8886
@thedmr8886 2 жыл бұрын
Amazing - thank you for sharing this! I have almost all of the parts here already - just need the voltage sensor!
@timmulhall2121
@timmulhall2121 2 жыл бұрын
Works a treat, great idea. Thank you!
@bruceshowalter6046
@bruceshowalter6046 3 жыл бұрын
Future TODO use a digital out to turn on/off a trickle charger to compensate for monitor parasitic discharge.
@Mr12v
@Mr12v 3 жыл бұрын
I use it through home assistant to turn the chargers on and off whe the battery drains. I have since moved to esphome and sleep the monitor as much as I can to save on the discharge factor!
@CodeWithCal
@CodeWithCal 3 жыл бұрын
How accurate do you find your readings? I have a similar setup stepping rough a 12v supply to 3.3v using the same 5:1 ratio voltage divider. Results are ball park how ever I would like to get it more precise.
@Mr12v
@Mr12v 3 жыл бұрын
Hi. I just used a volt meter to check the values and then changed the calibration values to give me the most accurate voltage to actual. I calibrated at about 12.5v which is somewhere at the mid point. They seem accurate enough!
@nuukemm
@nuukemm 2 жыл бұрын
This is great, thank you! Could you share a link to your Tinkercad box design?
@matisok
@matisok 11 ай бұрын
Hi there. Excellent tutorial. Building this myself now for my houseboat, though with node-red instead of Home Assistant. I am curious: why did you change to ESP Home? (as I read on the home assistant forum).
@Mr12v
@Mr12v 8 ай бұрын
It was really only because I had moved most of my other stuff over to esphome, it doesn't really add any functionality as such but I could tie in the deep sleep to my system better!
@grommet20002000
@grommet20002000 3 жыл бұрын
Can you post the template as its not possible to see clearly in the video and im getting syntax errors
@Mr12v
@Mr12v 3 жыл бұрын
Hi, Which template do you need?
@grommet20002000
@grommet20002000 3 жыл бұрын
The template sensor at 7:40 thanks
@Mr12v
@Mr12v 3 жыл бұрын
@@grommet20002000 here is the one I have setup in home assistant in the configuration.yaml - platform: template sensors: battery_v1: friendly_name: "Voltage Monitor 1" unit_of_measurement: 'volts' value_template: "{{ ((states('sensor.voltagesensor1_analog_a0')|float - 45 ) / 1024 * 3.3 * 5)|round (2) }}"
@grommet20002000
@grommet20002000 3 жыл бұрын
@@Mr12v Thanks for your video and help, i now have this in my template.yaml - sensor: - name: "Solar battery" unit_of_measurement: "Volts" state: "{{ (((states('sensor.green_house_analog_a0') | float -22) / 1024 * 3.3) * 5) | round(2) }}"
@sygad1
@sygad1 2 жыл бұрын
@@Mr12v I just pasted this directly into my configuration.yaml and it's giving me errors "end of stream" is there meant to be something before -platform: template? - thanks
@colincoleman7358
@colincoleman7358 3 жыл бұрын
Could you use the circuit board part of a mobile phone charger to provide the 5 Volt supply rail?. I ask this because I have several of these module that are no longer used, They all have different plugs on the end for when each phone had an alternate style power socket
@reg2590
@reg2590 3 жыл бұрын
Thanks for documenting this. My hybrid car's 12v battery has been flat a few times due to little use during lockdown such that it could not power the electrics for the car to start using the big drive battery. A Wi-Fi battery status sensor is a good solution either as an ESP8266 acting as a web server one can log into or as you suggest an ESP8266 sending MQTT messages to Home assistant or in my case NodeRed. I would like to keep the battery drain to a minimum so I intend to use tasmota's DeepSleep mode. My question is simple - Did you investigate the Tasmota DeepSleep command and if so was it successful?
@Mr12v
@Mr12v 3 жыл бұрын
Hi, I've converted one of then to use deep sleep through esphome although its the same thing. It works really well to be honest and keeps the last reported value in home assistant so you don't lose the value. I'm sure it could be done with tasmots just as easy yes!
@manfredschuhmacher5260
@manfredschuhmacher5260 2 жыл бұрын
great, thank you
@ljadf
@ljadf 3 жыл бұрын
Looks "real good" "up in here" y'all.. Was this designed for an American audience by any chance? :) On a more serious note, it'd also be "real good" if you could post the code you used for the template, as I'm also not able to see it clearly. Great work though, the closest I could get was a bluetooth module, which doesn't work with Homeassistant.
@Mr12v
@Mr12v 3 жыл бұрын
Hi, do you need the code i used in the home assistant?
@MrDallaskincaid
@MrDallaskincaid 3 жыл бұрын
@@Mr12v yes
@ljadf
@ljadf 3 жыл бұрын
@@Mr12v I did manage to find some code online which I modified to below, I found that by tweaking the '3.139' figure up or down, it tuned it to within 2dp of the measured figures: {{ ((states('sensor.mysensorname')|float -10) /1024 * 3.139 * 5) | round (2) }}
@Mr12v
@Mr12v 3 жыл бұрын
@@ljadf you have it there :) This is my Home Assistant sensor using the template. - platform: template sensors: battery_v1: friendly_name: "Voltage Monitor 1" unit_of_measurement: 'volts' value_template: "{{ ((states('sensor.voltagesensor1_analog_a0')|float - 45 ) / 1024 * 3.3 * 5)|round (2) }}"
@christophsuess7646
@christophsuess7646 Жыл бұрын
Thank you very much for the good video. Please share the tinkercad-File or (better) the stl-file with us. Please.
@Edmorbus
@Edmorbus Жыл бұрын
Could you share a link to your Tinkercad box design?
@Mr12v
@Mr12v Жыл бұрын
I'll try and get it uploaded yes!
@Edmorbus
@Edmorbus Жыл бұрын
@@Mr12v thanks
@brucerawiri7170
@brucerawiri7170 3 жыл бұрын
Hi there. Where can i find the tasmota Bin file for this project
@Mr12v
@Mr12v 3 жыл бұрын
It just uses the standard tasmota bin for the esp8266 :)
@marcuslibby6918
@marcuslibby6918 Жыл бұрын
im getting this error - Platform error tts.template - No module named 'homeassistant.components.template.tts', does anyone know why
Monitoring Voltage with ESPHome, D1 Mini ADC, and Home Assistant
23:07
DIY Car Battery monitor
7:25
Espruino
Рет қаралды 6 М.
Чёрная ДЫРА 🕳️ | WICSUR #shorts
00:49
Бискас
Рет қаралды 6 МЛН
Kind Waiter's Gesture to Homeless Boy #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 15 МЛН
Matching Picture Challenge with Alfredo Larin's family! 👍
00:37
BigSchool
Рет қаралды 43 МЛН
Monitor a Car Battery Remotely using ESP8266
6:35
MrDIY
Рет қаралды 39 М.
ESP32TTGO - Battery Indicator 🔋⚡
9:50
That Project
Рет қаралды 47 М.
DIY Whole Home Power Monitoring with ESPHome & Home Assistant
30:39
digiblur DIY
Рет қаралды 253 М.
Digital Dash MX5 Miata Arduino Custom TFT Cockpit
1:00
Jroobi
Рет қаралды 133 М.
Чёрная ДЫРА 🕳️ | WICSUR #shorts
00:49
Бискас
Рет қаралды 6 МЛН