Of course, after the power outage, one of my nodes decided not to come back. Another WD 120GB SSD bites the dust.
I've ratted the SSD out of the now dud `fluorine` node… it was set up identically aside from network, hostname and cryptography keys. I put the SSD in and it booted… I've renamed the node and updated `/etc/network/interfaces`.
Put it back on the rack, re-added it as a MON/MDS node, re-activated the OSD… and it seems all is well again.
Might need to get some new 120GB SSDs in stock since these old WD ones look to be reaching the end of their lives.
Did some proper scaling of the current shunts… looking at them physically, it appears I have a 100A shunt on the server rack and 50A shunts on the solar and battery.
Maybe they were bought at different times, but no matter.
Plugging the *correct* `lsb-microamp` helped a lot. I still have to put 1mΩ for the 100A shunt's resistance even though it's real resistance is 500µΩ, but the others really _are_ 1mΩ.
When I first tried it though, I had the Pico plugged into my laptop running from its own battery, and was getting 0V measurement for `V_BUS`… what the hell? No I hadn't changed the scaling, it really was reporting 0V.
Then after putting everything back, I twigged. The 0V reference is via USB. USB now from my laptop, which is running from its own battery. There is no longer a connection between the INA219s and the 0V rail of the server rack!
I wanted to add a spinlock because shell commands can clash with Modbus otherwise, so I added that and cleaned up my other changes… then dug out my laptop's 12V adaptor.
Plugged the laptop into a spare powerpole socket on the server rack, then flashed the Pico… bingo… I was reading sensible voltages now. I had to set the scale on the 100A shunt to 2.0 to account for the wrongly set shunt resistance, and I had to scale the solar shunt's current by 1.01 to get it to agree with the solar controller, but now everything is scaled correctly.
Managed to get everything installed without blowing anything up. I've got some scaling to do and possibly should consider a mutex on the INA219s, since I managed to deadlock my RPi Pico trying to poll the sensors whilst Modbus was also polling.
It'd be worth adding a function to return the value reported, and possibly adding a feature to allow measurement of the shunt voltage (the INA219 supports it) so I can scale everything correctly. Right now current is only approximately scaled, with the solar current being a total crap-shoot.
More work on the #SolarCluster tonight. Using #Zephyr to bridge between #collectd and some INA219 current shunt monitors.
The code runs on a Raspberry Pi Pico, and enumerates two USB CDC-ACM UART devices. One is a console, the other is a Modbus/RTU slave.
Two things I learned:
1. Your first CDC-ACM UART is easy, but a second one is a royal PITA.
2. Zephyr's Modbus stack assumes you have dedicated callback functions for each and every Modbus unit you create, with no concept of passing a user pointer or a unit ID to the callback function.
I had thought of a scheme where I had 3 units, the unit ID being equal to the I²C address of the slave, and just registers for voltage, current and power (Vshunt is not exposed by the Zephyr driver).
Nope, I've had to use one unit ID, and just offset the register numbers. But, whatever… I have a bridge now. I'll put in some settings interface so I can adjust scaling (the Zephyr driver assumes a shunt with a resistance in whole milliohms, mine is 500µohms) and we should be in business.
Code is a work-in-progress, but you can see it here: https://codeberg.org/sjlongland/modbus-ina219-bridge
Just finished helping lug 5 120W panels off the roof, and 3 350W solar panels onto the roof.
The 120W panels are stacked up ready for me to get out into some bright sunshine with a multimeter and a current shunt to test to see how well they're working. Two different lots: two slightly larger 120W panels and 3 smaller ones.
The new ones are connected… and in the fading afternoon light were producing a grand total of … 25 W.
Well, we'll see how things are tomorrow morning.
Didn't get to making the current shunt monitors, so the only real indication I have is to observe indirectly via the battery voltage, or go downstairs and poke the solar controller (unless someone knows how to talk to the CANbus on a Redarc Manager30?).
Got the boards modified and ready to be wired up. One gripe I'll make with the INA-219 boards that Adafruit make is they neglected to provide a terminal for the 0V to connect to the battery negative supply: they assume the microcontroller's negative rail connects to battery negative.
Similarly with the solar, the assumption of this is that the solar 0V connects direct to the battery 0V.
To quote Normie Rowe, it ain't necessarily so! I'd have used a 3-way screw terminal to allow connection of that 0V rail. We'll see what happens. The TS-7670 probably does common the USB 0V to its 0V DC input… but if there's an isolated DC-DC converter, that won't work, and I'll have to look at other options.
Knocking off the 0.1ohm resistors proved to not be that difficult… use an iron with a nice big chisel head on it, heat up one side of the resistor, then before it cools down, start attacking the other and begin working it off the pads.
A link I could cut would've been nice, but this works.
I've got to make up some 4-way KK jumper cables, but once that's done… I should be able to hook everything up.
Just lugged (with my father's help) 3×350W solar panels from the front door up to the back deck ready for installation on Monday.
https://www.snowys.com.au/12v-350w-fixed-solar-panel-glass-roof-top ← 20.1kg a piece, 1850mm×1015mm×35mm.
Bloody exhausted.
I've got some homework to do first… a RPi Pico and three INA-219 featherwing boards turned up yesterday. I have to knock the 0.1ohm resistors off those boards and solder up some connectors so I can hook them and the Pico up… then write some firmware for the Pico that'll poll the INA-219s and give me voltage and current measurements.
The current shunts are already on the rack: one on the battery feed, one on the solar and one on the load. I'll then plug that into the TS-7670 and write something to poll it over USB and feed `collectd`.
Maybe Modbus/RTU, since I think `collectd` supports that… not sure. (I did find `collectd`'s support for Modbus was crap though, might look at better options.)
Means next week I may have some 120W used panels… still producing a decent amount of current … looking for a new home.
One week on the new LiFePO₄ batteries… we're now considering upgrading the solar panels.
At the moment it's 5×120W or 600W peak capacity. If we go for 200W or 350W panels, we can possibly extract a bit more current for a longer period of the day. Thus I might just be able to make this thing self-sufficient … a job I've only been trying to achieve for nearly 10 years now.
At the moment, we only _just_ cover the load of the rack during the peak of the day.
Of course, if I do that, I'll have to figure out what to do with the old ones, either find a new home for them, or get them recycled.