Sunday, April 2, 2017

TriStar Monitor

How I spent my Sunday afternoon.  

It may not look very fancy but the next step in my solar monitoring is working. I have a Raspberry Pi  (that's the small black box in the center of the picture) connected to the Tristar TS-45 charge controller with the same USB to serial cable that I was using with the Lenovo laptop. I'm using a  heavily modified Python script that I found on the Internet to query the TS-45 every 30 seconds and writing the results out a temporary file with a some possibly useful variables. Plus, I'm appending the data to a CSV log file every 5 minutes.

I have another program that runs every minute which creates this simple html file on the Apache web server also running on the Raspberry Pi. Simply showing the current status with the battery sense voltage, array voltage, charging current, control state, PWM duty cycle, battery temperature and the computed power output. I was originally thinking of using an RRD and auto-generating graphs but decided that I can alway create graphs using the CSV log files anytime I want one. Maybe if I find myself really bored...

If you are unfamiliar with the Raspberry Pi3 model B, it runs on 5VDC drawing approximately 2 watts using a micro USB cable. It has a quad core 1.2 GHz processor, 1 GB RAM, built in 10/100 Ethernet, WiFi, Bluetooth 4.0, HDMI output, camera connector and 4 USB ports. This is in addition to the GPIO pins (digital i/o). Storage is a 32GB micro-SD card of which I'm using 3.7 GB. Basically a full blown computer that you can pick up for around $39. After you add a case, power supply, micro-SD card, etc. it'll be around $70. The one thing missing on the Pi is a real time clock. It really needs access to the Internet when it's booted up to set the date and time. Fortunately, I don't see it needing to be rebooted very often.

Now I simply need to get a small serial cable extension as there isn't enough room to install the TS-45 cover with the existing cable. And install a 12V to 5v micro USB to power the Raspberry Pi. Bridget didn't seem to understand why I was so thrilled to get this working. This was also my first foray into Python. 

4 comments:

  1. Bridget may not the only one having a hard time over your excitement, Richard. You are a true nerd, eh? ;-)

    ReplyDelete
  2. have to do some research on that gizmo thingy
    to see the whole picture of it
    glad your happy with it

    ReplyDelete
    Replies
    1. I also got it working with rrdtool (round robin database for time series data). The Raspberry Pi was developed as a teaching tool but it's turned into a lot more than that.

      Delete