Skip to content
View in the app

A better way to browse. Learn more.

Power Forum - Renewable Energy Discussion

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PowerForum Solar Data Collection - using a Raspberry Pi 3 :-)

Featured Replies

Viper ... you know, I am sommer going to use my Cellphone screen when I am not home, Pc screen (if it is on) when at home.

That way I save another 9 of the 10 watts in the evernings. :P

  • Replies 491
  • Views 93.5k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Let me tell you guys something. Writing at the lowest possible level, i.e. C and assembler, allows one to extract and use all the available power from a microcontroller. While there's not really aythi

  • Chris Hobson
    Chris Hobson

    Hi PLonky  When I am prototyping I generally use a breadboard rather than a breadbin.    

  • I'm making an image of the Rpi distro now. I'll post a link here in a few minutes, soon as I have the wifi details and stuff sanitised :-)

Posted Images

And if you are standing next to your equipment and forgot the phone in the house and you want to see some history event :D

mense gaan dink ek is mal hier by die werk soos ek lag

Okay people of the Pi, here you go.

 

https://drive.google.com/file/d/0By8zt_cN5USfaS0xbjEwT3dsUXM/view?usp=sharing

 

Some caveats.

 

1. I use the realtek 8188eu wireless adapter with this. To make that work properly, I had to install the 8188 driver (not the r8188 driver that ships standard). I also had to compile a new kernel in order to do that, so this ships with a new kernel, newer than what's currently in Raspbian Jessie. You're on your own if you want to use some weird wireless adapter that is not supported. I advise using ethernet, if you can. It's set up to do DHCP and should Just Work (tm).

 

2. I tried to make it safe, so it has a firewall on it. I use firehol (always thought that's an unfortunate name) for that. I have everything locked down except ssh (port 22) and pyramid (port 6543). If you need to mess with that, look in /etc/firehol/firehol.conf. Reasons why you might want to do this: You want to run something of your own here, or you want to open port 1883 so other computers can publish to MQTT.

 

3. Code is checked out in /home/pi/bluelantern, in different subdirectories. I compiled Mosquitto from source because the one that ships with Raspbian is old and crappy. You should be able to update anything by running "git pull" in the relevant directory.

 

4. Wireless config. Look in /etc/wpa_supplicant/wpa_supplicant.conf. Append something like this:

 

network={
    ssid="AP-name-here"
    psk="your-passphrase-here"
    priority=1
}

 

So what works out of the box? Well, very little. It starts up Mosquitto and the pyramid http server. You can point your browser to port 6543 to get the (unfinished) web interface. If your OS supports multicast DNS (linux and mac), you can browser to http://raspberrypi.local:6543/.

 

At the moment, there is only support for Victron mk2 inverters (multiplus and quatro), and to make it work, you have to manually run /home/pi/bluelantern/ib.bluelantern/src/ib/bluelantern/victron/mk2.py using the python in the venv directory. I have to make an entry point for it in setup.py :-) That has some issues too at the moment (it bails out the first time you start it), but just retry and it starts eventually (bug report, I have to clear the serial buffer at startup). This posts the DC voltage and amps to MQTT and half the stuff starts working.

 

Look at the two simulation scripts in the scripts directory for examples on how you might write your own. The two that is there uses random values. That bit is up to you :-) In the beginning, it might be easier to open up port 1883, then write the app on another computer :-) You can use any language that has an MQTT library.

 

Suggestions on how it might be made better are always welcome. Fork it on github and sent pull requests if you feel particularly inspired. This is not my best work, it's what I come up with between 11pm and midnight.

 

Also, it needs support for the BMV. BMV will be different, instead of being of type pv/load it will have its own type, because it gives you absolute charge/discharge values. Soon... :-)

Oh, and if you're paranoid, you might want to delete my public key in /home/pi/.ssh/authorized_keys... or leave it there if you actually want me to be able to get in :-)

1 hour ago, viper_za said:

And if you are standing next to your equipment and forgot the phone in the house and you want to see some history event :D

mense gaan dink ek is mal hier by die werk soos ek lag

Ditto!

But seriously thought, that ne, will happen the same day you go to your equipment and find the tablet dead. :D

Also, TTT, to get the data you want logged to a csv, subscribe to the topics you want in the file, and write it to a file. Python has a csv module, so it's going to be something like:
 

from csv import writer as csvwriter
import paho.mqtt.client as mqtt

fp = open("some/file.csv", "w")
writer = csvwriter(fp)

def on_connect(client, userdata, rc):
    client.subscribe("+/+/power")

def on_message(client, userdata, msg):
    writer.writerow(['voltage', msg.payload])

client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect('localhost', 1883, 60)
client.loop_forever()

Completely untested, basic idea is to subscribe to the topic and just write to csv. I'm a bit naughty here, not closing my file descriptors, because when the process ends python garbage collects the objects that goes out of scope and resource manangers (like files) will close automatically. :-)

 

I'm going to do something similar, but instead I want to log to an internet service, or graphite.

And finally (way too much posting here today), using a whole bunch of spare parts that got dumped on me by an emigrating colleague, I started assembling my canbus interface into an old CD case last night, after building the bare bones Arduino over the weekend. The bit in the middle is a ftdi usb-serial converter, plugged into an adafruit serial->ttl board, with an extra 5V supply bridged onto the usb. If all goes well, I'll have this part working by the end of the week and I can start serious development on the Ve.Direct interface :-)

 

vecan.jpg

No kitchen, breadboard, seems like it is on your desk ... ok, lets find something .... uhm that duct tape around that black cord ... :D

Other than that, looks beautiful!!!

I am also using the RPi and some other micro controllers for another project. If you run your Pi as a client normally you are going to need to add this bit or else your pi's wifi goes to sleep.

sudo nano /etc/modprobe.d/8192cu.conf

and then add this bit to the conf file

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

 

7 minutes ago, jdp said:

# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

 

Yup, I have a similar version for the 8188 in there. And I blacklist the r8188 too.

Man... the RPI has really pathetic current capabilities on the USB ports. The can converter runs fine on the laptop, fizzles out after about 5 packets on the Rpi. So just another hurdle, it's going to need it's own power supply.

I was planning on using a powered USB hub on the Rpi, for I anticipated USB issues.

Bonus is you can then add a few more things to the Rpi.

1 hour ago, The Terrible Triplett said:

I was planning on using a powered USB hub on the Rpi, for I anticipated USB issues.

Bonus is you can then add a few more things to the Rpi.

I do this on my tablet too :lol:

I just had to do this sorry TTT

I know with some stting you can up the current on the usb. Just have to goole it again. I did it with mine to power a portable device

Sent from my SM-G920F using Tapatalk

I know with some setting you can up the current on the usb. Just have to goole it again. I did it with mine to power a portable device

Sent from my SM-G920F using Tapatalk

Sent from my SM-G920F using Tapatalk

2 hours ago, viper_za said:

I do this on my tablet too :lol:

I just had to do this sorry TTT

ROFLMAO!!!

23 hours ago, The Terrible Triplett said:

 

Don't let Viper hear you say this, he will just want you to use a Tablet.

Sorry VIPER, I could NOT stop myself!!! :D

I wouldn't mind using a tablet either, but it's too expensive and too limited. Perhaps it could be a great monitor / viewer that connects to a decently utilized MCU / controller in between that can interpret the data on the inverter, battery bank, panels, load, etc. 

Just now, SilverNodashi said:

I wouldn't mind using a tablet either, but it's too expensive ... 

Don't let Viper hear this sacrilege ... :D

 

Rpi is the only way to go to replicate what Victron has done. Why else would Plonkster be so active on this? Saving cost on Victron equipment off course. :D

I am running a Arduino on it just fine. But I do have external power to all the sensors etc.

2 minutes ago, jdp said:

I am running a Arduino on it just fine. But I do have external power to all the sensors etc.

Sorry, Rpi and Arduino.

Running a Arduino on the Rpi yes.

Yes that is the Arduino. I power it from the Rpi's usb port.

Why power a Rpi from a Arduin?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.