Create your own temperature logging for your Opus BT-3100 charger


How to create your own temperature logging for your charger

On this page i will briefly go through and show you guys how i made my own temperature logging and did add that to one of my Opus BT-3100 chargers.

 

Tools needed:

  • screwdrivers
  • pliers
  • soldering iron
  • hot glue gun
  • drills, 7mm and 3mm

Hardware used/needed

  • Opus BT-3100 or any other charger – Buy Here
  • Raspberry pie. Recommend version 2 or later  – Buy Here
  • Temperature sensors 1wire DS18(b/s)20  Buy Here
  • wires
  • 4.7k resistor – Buy Here

More info is pending but will be added here along with images. For now i recommend to check out the Youtube video setup for further instructions.

 

 

Software – the simple way

If you want to go the simple route and just show latest temperatures on a webpage like below this is how you should do it.

  • Plain installed Rasp with raspian
  • apache2  –  as webserver to display the numbers
  • bc – To round the numbers given from the sensors.

 

First of all go ahead and install above packages needed:

sudo apt-get install bc apache2

What you then need to do is to add this line

dtoverlay=w1-gpio

into /boot/config.txt wherever you want and then reboot the computer.

When that is done you can go ahead and add this script:

#!/bin/bash
# This script is created by daromer aka DIY Tech & repairs
# 2017 and you are free to use it as long as credits goes back to me
# http://diytechandrepairs.nu
# https://www.youtube.com/channel/UCI6ASwT150rendNc5ytYYrQ

#This defines what file to store the data in for your webserver
webfile=”/var/www/html/temp.html”
#Where the 1wire sensors resides
path=”/sys/bus/w1/devices/w1_bus_master1/”

#DOnt edit below unless you know what you are doing

if [ `grep -c “dtoverlay=w1-gpio” /boot/config.txt` -lt 1 ]; then
echo “You need to add \”dtoverlay=w1-gpio\” to the bottom of /boot/configt.txt and reboot your computer”
exit
fi
if [ `lsmod | grep -c w1_gpio` -lt 1 ]; then
echo “Trying to include w1_gpio for you. You have to restart this program. If it fails again please investigate”
modprobe w1_gpio
exit
fi
if [ `lsmod | grep -c w1_therm` -lt 1 ]; then
echo “Trying to include w1_therm for you. You have to restart this program. If it fails again please investigate”
modprobe w1_therm
exit
fi

if ! [ -x “$(command -v bc)” ]; then
echo ‘bc command is not installed. Run apt-get install bc.’ >&2
exit
fi
echo “All fine and dandy and program is now up and running. Kill it with ctrl + c”
while [ 1 ]; do

echo `date`>/tmp/temp
echo “<br>”>>/tmp/temp

for i in `find $path -type f -name w1_slave`; do
name=`echo $i | cut -d’/’ -f7`
if [ `cat $i | grep “YES” | wc -l` -gt “0” ]; then
#We just make sure its a yes in output. if so value is ok and we process it for graphing
val=`cat “/sys/bus/w1/devices/w1_bus_master1/${name}/w1_slave” | grep “t=” | awk ‘{print $10}’ | sed ‘s/t=//g’`
val=`echo “scale=2;${val}/1000” | bc`
echo “$name $val<br>” >>/tmp/temp
fi
cp /tmp/temp $webfile

done

sleep 10;
done

And then just execute this with ./<the name of the script.sh>

This will produce output that should be shown in https://<ip to your rasp>/temp.html.

Software – The more complicated way

Above image is drawn up by Grafana. A very good front end that fetches data from Graphite.

I will not go into here how to install that but just refer to some links that will help you out. First of all there is no pre-made packages for running Grafana on Raspberry pie by the vendor but there are some guys that have some packs on Git for that instead.

First of all you need to make sure you have a running Rasp with Raspian. I recommend you follow this guide:

https://www.linode.com/docs/uptime/monitoring/deploy-graphite-with-grafana-on-ubuntu-14-04

Some changes in above is that when you configure Carbon i would use this instead:

[temp]
pattern = ^temp\.
retentions = 5s:3h,1m:2d,5m:30d

And when it comes to installing Grafana go here for fetching your desired packages: https://github.com/fg2it/grafana-on-raspberry/releases

If you have followed all those gguides do have a script that will feed all data from your sensors into Graphite and you can then create above beautiful graphs from your charging station!

if [ `grep -c “dtoverlay=w1-gpio” /boot/config.txt` -lt 1 ]; then
echo “You need to add \”dtoverlay=w1-gpio\” to the bottom of /boot/configt.txt and reboot your computer”
exit
fi
if [ `lsmod | grep -c w1_gpio` -lt 1 ]; then
echo “Trying to include w1_gpio for you. You have to restart this program. If it fails again please investigate”
modprobe w1_gpio
exit
fi
if [ `lsmod | grep -c w1_therm` -lt 1 ]; then
echo “Trying to include w1_therm for you. You have to restart this program. If it fails again please investigate”
modprobe w1_therm
exit
fi

if ! [ -x “$(command -v bc)” ]; then
echo ‘bc command is not installed. Run apt-get install bc.’ >&2
exit
fi
echo “All fine and dandy and program is now up and running. Kill it with ctrl + c”
path=”/sys/bus/w1/devices/w1_bus_master1/”
while [ 1 ]; do
for i in `find $path -type f -name w1_slave`; do
name=`echo $i | cut -d’/’ -f7`
if [ `cat $i | grep “YES” | wc -l` -gt “0” ]; then
#We just make sure its a yes in output. if so value is ok and we process it for graphing
val=`cat “/sys/bus/w1/devices/w1_bus_master1/${name}/w1_slave” | grep “t=” | awk ‘{print $10}’ | sed ‘s/t=//g’`
val=`echo “scale=2;${val}/1000” | bc`
echo “temp.$name $val `date +%s`” | nc -q0 127.0.0.1 2003;
fi
done

sleep 10;
done

What more can i do?

Its just your imagination that stops you. Some examples below:

  • Setup alarms sending out emails or Pushover direct messages when temperature goes to high. (Grafana or in a script)
  • Connect the Pie to an SSR relay and shut of that specific charger if it goes above a thresh hold set
  • Put up big monitors above the station showing all stats you need
  • Be able to sort cells and see how they do perform. You can make trends and even distinguish bad from good ones
  • You can even add this type to your battery packs directly! Nothing stops you.

And much more!

 

Note that above is just a draft on how i did it and some details may have been left out. If you have questions or comments i suggest you head over to my Youtube channel and ask them there.

Liked it? Take a second to support daromer on Patreon!