Category Archives: Hardware

An OpenSprinkler success story

I wanted to automate the watering system at home preferably using open-source and DIY systems. The initial plan was to go with plain RPi, OpenHAB and some GPIO code driving the sprinkler valves but the problem was creating a useful UI to control the system since OpenHAB is too clunky and generic looking. I was also not quite ready diving deep into embedded programming and OpenHAB programming model. OpenSprinkler  seemed to have everything I needed, a RPi hat with all the correct electrical outputs and an open source firmware and android app I could modify myself if needed. In the end, programming the sequences myself and trying to make a decent UI would be just too much work for a small pet project so I went with a ready solution.

The requirements

  1. Three separate zones around the house, max 7 sprinklers per zone.
  2. Each zone must be turned on separately due to the pressure requirement for the sprinklers to work.
  3. Pump that drives the water must be turned on automatically with each zone valve.

Setting up the OSPi

OpenSprinkler offers fully assembled systems but I decided to go the DYI route using my own RPi and just buying the OSPi hat.

  • RPi 4 Model B 2GB
  • RPi official charger
  • OSPi (VAC)
  • 32GB SD card
  • Orbit 57056 2-Pin European Transformer

Finding a 24VAC power supply with EU plug was quite a challenge, the listed model from Orbit was one of the rare ones I could find online (on Amazon).

It is mentioned in OpenSprinkler documentation that a separate power supply for RPi is recommended. This was confirmed while testing where I saw dmesg errors about voltage not being sufficient and RPi rebooting endlessly. I ended up using the official RPi charger and the 24VAC charger at the same time.

Installing raspbian and OSPi firmware was easy with no problems encountered. Assembling the OSPi was also not problematic, other than drilling some holes into the supplied enclosure for the USB cable and WiFi adapter.

The WiFi

The built in WiFi on RPi would not work even half of the required distance and was simply horrendous. Onboard WiFi can be disabled by modifying /boot/config.txt and adding

dtoverlay=disable-wifi
in the [all] section.

After checking compatibility lists and reviews for RPi compatible USB WiFi adapters I went with Edimax EW-7811UN. I disabled the integrated card and configured the /boot/wpa_supplicant.conf to connect to the dedicated WiFi extender AP as a priority.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
 ssid="Home_Ext"
 psk="pass"
 id_str="ext1"
 priority=5
}


network={
 ssid="Home"
 psk="pass"
 id_str="main"
 priority=10
}

In the end I managed to achieve a not so great but stable signal from the house to controller box at around -60db. For the WiFi extender I went super cheap using TP-LINK TL-WR840N (15EUR) and positioning it with no walls blocking the signal other than a single garage door. I also added a small script to sudo cron to automatically restart RPi in case of any network downtime.

ping -c4 192.168.1.1 > /dev/null

if [ $? != 0 ]
then
  sudo /sbin/shutdown -r now
else
  echo $(date) "Internet is UP"
fi

Driving the Pump

Looking for a relay to turn the pump on and off I decided to go with an off delay relay as an extra safety that will automatically turn off after the selected period of time. This is just in case OSPi goes haywire and does not turn off as scheduled or someone makes a mistake of turning the sprinklers on for too long. Pump draining all the water and running dry is a very bad scenario I would like to avoid. The model is a Tracon multifunction relay AC/DC 12-240V driven by 24VAC OSPi.

Putting it together

Relay is connected to OSPi port 0 (master zone) which is always turned on with either valve 1, 2 or 3. Relay drives the first power socket for the pump. The other two sockets are for Orbit 24VAC and RPi charger. This way the pump can be disconnected at any time and used manually.

The valves

24VAC valves are quite common. I found three candidates from Orbit, Rainbird and Cleber. In the end it came down to price and availability, so I went with 3x Rainbird CP075 off eBay, roughly 30$ each.

Finally, to connect the valves to OSPi I got some 4×0.75mm cable and some waterproof clips to connect them on the valve side. These are automatic clips put in a box full of gel which seals it when closed.

Operation and conclusion

It turns out the OSPi firmware and app has the exact functions I need to drive the setup. Master zone translates perfectly into the pump relay. For each valve, the "continuous" setting (which is default) allows you to setup a single schedule program and OSPi will automatically drive each valve one after another and not all at once (which would not work due to low pressure). Without the continuous setting one would have to write a separate program for each valve which is a bit clunky.

One thing that does not work quite as good is automatic rain delay. The idea is, if sprinklers are scheduled to work today but there is a rain forecast, delay the program for some time, like a day. Unfortunately, if it does not rain at all, delay is still present. It would appear that OSPi only checks the forecasts but does not adjust the delay according to actual mm of rain that has fallen. I need to research this function in more depth to figure out the exact behavior and whether I can improve upon it.

Another glitch that appears once a month or so is that OSPi is randomly not accessible. This is fixed with the main router reboot. I am not sure yet what exactly causes the problem, whether the auto-reboot script works.. more investigation is needed. It probably boils down to not so great WiFi connection.

In the end I am quite happy I went with the OpenSprinkler and not a full DIY solution. It saved time, does everything I require and I am able to modify it if ever needed.

 

2023 update

After the system being dormant through winter of 2022/2023, the RPi would no longer boot. The Sandisk Ultra SD card seems to have got corrupted for some reason so I had to re-image and reconfigure OSPI again. I replaced the card with a Sandisk Industrial series card which are supposedly more tolerant to heat and cold. We'll see how long this one lasts.

Other than that the system is still working great.

Cen
GitHub
Eurobattle.net
Lagabuse.com
Bnetdocs

Ubuntu 18.04 on MacBook Pro 11.5 – a sad state of affairs

There was an extra MacBook Pro 11.5 lurking around so I decided to install Ubuntu 18.04 on it and try to setup a usable workstation.

A culmination of several issues prompted me to not pursue this setup further. Linux drivers and MacBook hardware just don't play along very well.

Display flickering/corruption on main display

The bottom part of the HiDPI screen is experiencing some kind of flickering as tracked by this bug. Changing desktop environment, distros and X server configuration did not result in any improvements. For a moment Wayland seemed to have solved the issue only to reappear on next boot.

Since I also connected 3 external monitors this was not a deal breaker. External monitors did not display this issue.

Fan going at 100% most of the time

Even at idle or low load the fans would spin at 100%. Thermald was not doing it's job for whatever reason. It is hard to say why since most temperature sensors seem to be working fine and report acceptable temperatures.

I found a simple but great project called mbpfan which stopped the fans immediately after being started and still kept temperatures seemingly in check. I increased the minimum fan speed in mbpfan config just to avoid any potential overheating problems. With this setup I was getting 70-80 degrees with no overheating problems and a quiet fan.

CPU is in constant low frequency state (dealbreaker)

After installing cpufreq gnome extension I figured out that CPU is always at 800MHz. Mbpfan was not the cause since the same lack of scaling appeared when it was turned off.

First I tried to disable Intel p_state driver but the lack of scaling continued. Using userspace driver in cpufreq, I was unable to change min/max frequencies or force a specific frequency via cpupower.

As per ArchWiki, I gifured out that BIOS was enforcing this state via

cat /sys/devices/system/cpu/cpu0/cpufreq/bios_limit

After ignoring ppc via

echo 1 > /sys/module/processor/parameters/ignore_ppc

the CPU instantly started to scale as expected. Unfortunately this was not the final solution since the low state  would randomly reappear again for long periods of time with small time windows of scaling working as expected. Therefore, even with ignore_ppc I would still get 800MHz most of the time with temps reported around 70 degrees.

In this state Gnome Shell would lag and everything was half-usable.

Something in hardware was throttling CPU and I wasn't able to overcome it.

Bcmwl driver very spotty

WiFi bcmwl driver is very spotty. It would connect to Android hotspot no problem but it failed to connect to WiFi router. Small sample of 50% reliability.

Display positions not remembered after reboot

I had to rearrange the external monitors on each reboot since Gnome would not remember their positions. I had to come up with xrandr script to run after login to remedy this sad state of affairs.

No per-monitor scaling

Gnome still does not support setting the scale factors per monitor. Again, I had to come up with xrandr script to achieve 200% scaling on HiDPI and regular scaling on external monitors (1900×1200).

Broken scaling under Wayland

Apparently if you set the scale factor to default in Wayland session, things should "just work" across HiDPI and non-HiDPI displays. Don't believe these people, they are liars.

I set the scaling to default but that made HiDPI desktop tiny while external monitors were fine. Increasing the scaling to 200% made HiDPI fine while external monitors scaled also.

There is also no xrandr under Wayland so you can't help yourself with that.

Broken rendering of electron apps on external monitors

If using Postman on an external monitor, parts of the dialog boxes would simply disappear, making the tool unusable. Using Postman on main display did not have this issue. Weird.

 

The bottom line: get a Dell or a Lenovo for your Linux workstation needs.

Cen
GitHub
Eurobattle.net
Lagabuse.com
Bnetdocs

Fedora 25 on Lenoyo Y50

Everything except WiFi worked out of the box. To get the WiFi working:

sudo dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-25.noarch.rpm
sudo dnf install http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-25.noarch.rpm

# The rest
sudo dnf install kernel-devel broadcom-wl akmod-wl akmods
sudo akmods
sudo reboot

Taken from here.

In your BIOS make sure you disable Secure Boot. Not UEFI, not Legacy mode, specifically the switch that disables secure boot and nothing else. After these steps, WiFi works. To enter BIOS on Y50, tap F2 after Lenovo splash screen.

 

Edit 7.2.2017: WiFi performance is unfortunately ABYSMAL. Will update this post if I find any solutions. Connection is super slow and constantly dropping.

Luckily, USB tethering from Android works like a charm so it's not a deal breaker for now.

Edit 2: looks like blacklisting bcma driver makes things much much better:

sudo nano /etc/modprobe.d/blacklist.conf

#add this
blacklist bcma

sudo systemctl restart NetworkManager

 

Cen
GitHub
Eurobattle.net
Lagabuse.com
Bnetdocs

Black screen with Catalyst > 13.4 on Asus N71jq and similar

If you own an Asus N71jq or a similar laptop model from 5 years ago you probably tried to update your Catalys drivers to something more recent. Official Asus support page only provides an ancient version from 2010. If you try to use the official and latest AMD drivers you will end up with a black screen during the installation process.

After a lot of digging on Google I found out that this is a widespread problem and the last driver from AMD that still work turns out to be 13.4, which is not ideal, but still better than what Asus provides. Sometimes after that apparently the back lighting of the screen is broken. Source.

Finding 13.4 drivers is a challenge. Guru3D used to have all versions listed on their websites, but AMD blocked external linking some time ago, so all links are a dead end. You also can't find 13.4 in AMD driver archives. So after scouring the internet, I finally found a working version. I am attaching it to this post for your leisure.

Download

Cen
GitHub
Eurobattle.net
Lagabuse.com
Bnetdocs

My personal FreeNAS build and review

This post will talk about how I built my own FreeNAS box, including a short review of the components used. I will also try to mention all the problems and pitfalls that I can remember.

Components used

Component mini reviews

ASrock C2550D4I

This motherboard is the perfect choice for a NAS box. It has a low power Atom processor, passively cooled, micro ITX and most importantly.. 12 freaking SATA ports. Which means you won't even need an add-on card for the build. It also comes with 2 Ethernet ports and a dedicate IPMI.


The good:

  • low power, silent
  • 12 SATA ports
  • 2 Gigabit LAN ports and dedicated IPMI port
  • nice web management interface
  • good manual
  • no other manufacturer provides anything similar to this motherboard

The bad:

  • no USB 3.0 header which means the front USB on DS380 is completely useless (unless you get a PCI-E USB controller)
  • only 3 USB 2.0 ports, either 1 front and 2 back or vice-versa (again, unless you get a PCI-E USB controller)
  • in configuration with DS380, the ATX power connector is on the "wrong" side which means that the ATX cable has to go all across the motherboard. In a normal computer case this wouldn't be an issue though
  • price

Bough on amazon.de for 301€

 

SilverStone DS380

This case is pretty much perfect for a NAS box. It has eight 3.5" hot swap bays and additional 4 internal 2.5" bays. You also don't need to worry about providing 12 SATA power cables because it has a circuit with 2 molex input connectors which power all 8 hot-swap bays.. no Y splitters needed.

 

 

The good:

  • eight 3.5" hot-swap bays and four 2.5" internal bays
  • premium look-and-feel
  • removable dust filters on all intakes
  • hot-swap circuit which also supplies power
  • the 2.5" cage is removable
  • front USB and sound is removable

The bad:

  • the fans are not the most silent on the planet
  • the manual is not the most accurate
  • the hot-swap circuit has two fan headers for the two side fans but if you use them, you can't control them from the BIOS at all
  • there is nothing to soften the vibrations from the drives in the caddies or the cage. Putting your hand on the case noticeably silences the system so improvements could be made.
  • price

Bought from local online shop for 182€

SilverStone SST-ST30SF

We need a SFX power supply for our case and there are not that many on the market to choose from. This is a very silent 300W power supply which is more than enough for everything we need. It just happened to be in my local online shop, the price was good and it matched the case so I went with it.

The good:

  • so far I haven't even seen the fan to spin up so this is effectively a passively cooled power supply
  • premium look-and-feel

The bad:

  • the ATX cable could be longer. It barely reaches the motherboard connector which means you can't really move it away if something else is blocking the path.. and since it goes all across the motherboard it bumps into the USB stick that holds FreeNAS, at least in my case.
  • it would be great if this was modular because we don't really need anything but ATX and 2x molex for the build (unless you use the internal bays)

Bought from local online shop for 60€

Crucial 8GB ECC DDR3-1600 CT102472BD160B

The only reason I went with this is because it was on ASrock memory QVL list and one of the only 8GB sticks from a somewhat reputable manufacturer. I got only one due to budget constraints but there are 3 slots left to upgrade at any time.

Bought from local online shop for 90€

 

4x HGST Deskstar NAS 4TB

I bough 4 of these, mainly because they are from HGST which I had a great experience with so far and the fact that they are 7200 RPM NAS drives. Online reviews also hinted that they beat WD Reds and Seagate NAS drives so I went with them.

The good:

  • HGST
  • price

The bad:

  • 4 of these spinning cause a lot of noise and you can hear them from quite far away. This is also the main source of noise in the build, everything else is relatively silent.

Bough from local online shop for 480€

 

Lian-Li PT-FN03

I bough this fan controller mainly because it fits in the PCI slot while most other controllers fit into the front of the case. The reason why I even got this is because I could not control the fans from BIOS at all so they were spinning at full speed all the time. But on the end it did not really matter much because the 4 disks are so loud that you don't even care about the fan noise. Looking from that perspective it was probably a failed purchase. Other than that it works ok and it comes with a molex splitter so you are not losing any connectors from your power supply.

Bough from amazon.de for 15€

 

USB header adapter and stick

If you want to put the USB stick with FreeNAS inside the case you need to buy a USB header to female (normally 2x female) adapter. By default, the ASrock motherboard has 2 USBs active at the back and one at the front header, so only one of the female connectors on the adapter will actually work. If you can't see the USB stick as bootable option in the BIOS, this might be the problem. Simply put the USB stick in the other slot.

Total cost

Roughly 1200€

The build

Fan controller was not used in this guide.

  1. Open the case, remove both cages. Optionally remove the front IO if you won't need it
  2. Mount the power supply
  3. Mount the motherboard
  4. Insert the RAM
  5. Plug in all the fans, front IO and ATX power
  6. Plug in all SATA cables into the motherboard. I suggest you start with the Intel ones (see manual for which is which). If you use regular HDDs use SATA 2 first and leave SATA 3 for the future (perhaps for SSDs).
  7. Plug in the USB header adapter and your FreeNAS stick. Note that if you have header->2x female adapter, one of them will be disabled by default.
  8. Put the 3.5" cage back in, leave the 2.5" one if you won't use it at this point
  9. Plug 2x molex and SATA cables into the cage
  10. Put the hard drives in caddies and insert them
  11. You should now be ready to boot. Enter BIOS, set the USB as first boot option and off you go

One thing I am not 100% sure is how to access the BIOS through IPMI to set the boot options (so we don't have to plug in the monitor and keyboard). The management software on the motherboard should have a default IP out of the box but I am not sure how you get to know the IP without checking it out in the BIOS. Tips welcome.

Other than that, the Megarac Management Platform that ASrock provides is very nice. It allows you to see the console output and power ON/OFF the server from your workstation.

Once FreeNAS boots it will output the web UI IP in the console. The other way you can figure out the IP is to open your router and check the DHCP table.

 

Conclusion

I ended up with creating a raidz2 zpool which turns out to be roughly 8TB of empty space. The reason I chose raidz2 is because when a disk dies I can comfortably send it to repair or buy a new one. This can take a few weeks so running in degraded state in case of raidz1 is probably not the smartest thing to do.

There are a few things that can be extended and improved in the future. I still have place for four 3.5" drives and since the single drive sizes are already at 6TB I will probably just create a new zpool when I need it. I also have four 2.5" bays still available inside the case so I could potentially buy SSDs when they become even cheaper and have greater capacities. 24GB of RAM can also be added.

The PCI-E 8x slot is unused at the moment. I could throw a GPU in there and have the box work as a HTPC machine although the noise from the hard drives would not be welcome anywhere near TV. The slot could also be used for additional USB 3.0 headers, so the front panel would actually be usable.

With all this expandability in mind, I am probably good for 5+ years in terms of storage.

 

 

Cen
GitHub
Eurobattle.net
Lagabuse.com
Bnetdocs