This site is my personal blog and project repository.

If you are looking for the old Cowichan Valley Linux Users Group, check the side navigation. This site contains links to various projects that I either created or contribute to.

You will also find my Github page and Youtube channel here. Contact: cwg@cowlug.org


Latest News

DC Power Supply and Load Tester

Posted on: July 17, 2019, in AllEquipmentSmall Touch Displays

This post describes my build of a new power supply and DC load tester for testing batteries and power supplies.  Kudos go to Lawrence Glaister, VE7IT who is also building one and was instrumental in the co-design of this project.

Features:

  • Dual adjustable supplies 0-24VDC at 5amps.
  • 12VDC Fixed at 5 amps.
  • 5VDC Fixed at 5 amps.
  • Dual USB power ports.
  • DC Load tester up to 20 amps (see note).
  • All supplies are isolated and change be chained together.
  • Load testor showsdisplays Time, Volts, Current and mAh.
  • Load can run for user supplied time or voltage set point.

Missing Features to be added:

  • Filter board for DC conditioning.
  • Logging of Load test for input into spreadsheet etc.

Description:

I built this supply in and old rack mount case but it could be built into anything.  Power supplies are off the shelf from our friends in China. 

The DC Load was a custom build and all schematics and code for microcontroller is available from my github page.  I will include links here as well.  Schematics are drawn in Kicad.  If you haven’t tried Kicad you should, it’s amazing and 100% freely available open source code.  I use it under Linux.

Power supplies:
The four power supplies are split into two fixed and two variable supplies, each capable of sourcing 5 amps. The two fixed supplies are set at 12 and 5 VDC.  The variable ones can realistically run from 1 volt up to 24.
 
Typical wiring for one panel is shown here:

I bought all my supplies from Banggood but I'm sure they can be had from anywhere.

The 120VAC to 24VDC supply is a: "Geekcreit® 4A To 6A 24V Switching Power Supply Board AC-DC Power Module"

The other supplies for the variable and fixed side are constant current, constant voltage supplies, where the on board potentiometers were replaced with panel mounted potentiometers. I soldered 3 pin headers to the supplies for easy mounting and replacement.


The 5VDC fixed supply is also connected to two USB A connectors on the front panel for powering and charging purposes. They run through the ammeter as well.

The wiring for the USB includes resistors that allow full current charging of supported devices.



Pytomation running on Pi3 with TFT display and power circuit.

Posted on: March 12, 2018, in AllPytomationRaspberry PiSmall Touch Displays

I recently got a TFT display and a serial port board with a small bit of breadboard space hooked up to my Raspberry Pi3, for running Pytomation. See the side menu for more about automation with Pytomation. I wanted something I could power down, removing power from the Pi board, then start up again with the push of a button. The entire assembly is built with the following components (see the article from January about configuring the TFT display):

.

This is the Pi serial expansion board including breadboard area. It is available from https://www.abelectronics.co.uk.


.

This is the schematic of the power circuit. It works as follows:

Once the Pi has booted pressing the bottom button on the TFT display, which is connected to GPIO 17, will initiate a shutdown of the operating system, The very last action taken during the shutdown sequence is to enable (logic high, +3.3v) GPIO pin 26. GPIO 26 turns on the "set" coil of the relay which in turn will remove power from the Pi board. The 470uF capacitor provides just enough additional power to the Pi to properly latch the relay before removing power. Pressing the pushbutton will pulse the "reset" coil and power will be restored to the Pi, which then boots.

Here is a quick video of the board operating.

Parts list:
    1. Raspberry Pi3 with USB power supply and SD card, running Raspbian 9.
    2. Adafruit 2.8" Capacitive display from BC Robotics
    3. SerialPiPlus an RS232 board with breadboard space.
    4. 3.3 volt dual coil latching relay model EE2-3TNU.
    5. 3.3volt three terminal regulator.
    6. IN4148 diode.
    7. Green LED.
    8. 470 ohm, 1/4 or 1/8 watt resister
    9. Normally open pushbutton switch.
    10. 470uF, 25volt electrolytic capacitor.
    11. USB male connector/cable end.
    12. Various standoffs and hardware.

Once the board is complete with the power on/off circuit you must make some changes to your Raspbian installation. There are two things that must be done. Add support for the power down button on the TFT display and add support for GPIO pin 26 to change to a high state (3.3v) one it is safe to remove power from the Pi3.

To get the TFT display working see my article from January 2018, PiTFT

TFT display button support:
This tells the Pi to watch GPIO pin 27 which is one of the buttons on the TFT display, when pressed it will shutdown the Pi.
Login and edit the /boot/config.txt file to add the following at the bottom of the file.
dtoverlay=gpio-shutdown,gpio_pin=27

This is from the /boot/overlays/README file.

Name:   gpio-shutdown
Info:   Initiates a shutdown when GPIO pin changes. The given GPIO pin
        is configured as an input key that generates KEY_POWER events.
        This event is handled by systemd-logind by initiating a
        shutdown. Systemd versions older than 225 need an udev rule
        enable listening to the input device:

                ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
                        SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
                        ATTRS{keys}=="116", TAG+="power-switch"

        This overlay only handles shutdown. After shutdown, the system
        can be powered up again by driving GPIO3 low. The default
        configuration uses GPIO3 with a pullup, so if you connect a
        button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
        you get a shutdown and power-up button.
Load:   dtoverlay=gpio-shutdown,=
Params: gpio_pin                GPIO pin to trigger on (default 3)

        active_low              When this is 1 (active low), a falling
                                edge generates a key down event and a
                                rising edge generates a key up event.
                                When this is 0 (active high), this is
                                reversed. The default is 1 (active low).

        gpio_pull               Desired pull-up/down state (off, down, up)
                                Default is "up".

                                Note that the default pin (GPIO3) has an
                                external pullup.


GPIO pin 26 support:
Login and edit the /boot/config.txt file to add the following at the bottom of the file.
dtoverlay=gpio-poweroff,gpiopin=26

This is from the /boot/overlays/README file.
Name:   gpio-poweroff
Info:   Drives a GPIO high or low on poweroff (including halt). Enabling this
        overlay will prevent the ability to boot by driving GPIO3 low.
Load:   dtoverlay=gpio-poweroff,=
Params: gpiopin                 GPIO for signalling (default 26)

        active_low              Set if the power control device requires a
                                high->low transition to trigger a power-down.
                                Note that this will require the support of a
                                custom dt-blob.bin to prevent a power-down
                                during the boot process, and that a reboot
                                will also cause the pin to go low.

Now assemble all the pieces. Stack the serialpi board on the Pi first , then the TFT display hat on top of the serial board, then power on your Pi. You should be able to safely shutdown the Pi by pushing the bottom button on the TFT display. To turn the Pi back on, press the pushbutton wired into the power circuit.

Here is a picture of the completed project:
.




PiTFT small displays for Raspberry Pi

Posted on: January 2, 2018, in AllRaspberry PiSmall Touch Displays

This explains what I had to do to get the Adafruit 2.8″ Capacitive display working under Debian Stretch on a Raspberry Pi 3.

At this point in time, January 2018, the tutorial on the Adafruit page only deals with getting the displays working under Debian Jessie. Stretch was released on June 17th, 2017 and it’s a bit sad that Adafruit has not updated their tutorial.

Here are the steps:

  1. Install Debian Stretch on your Pi3. I used the 2017-08-17 image from downloads.raspberrypi.org.
  2. Make sure everything is up to date with: sudo apt-get update and then sudo apt-get upgrade, then reboot.
  3. Download the adafruit-piftf-helper2.sh script from here, I have a local version here but it may be old now, please check.
  4. Make the script executable -> chmod +x adafruit-pitft-helper2.sh
  5. Now run the script with the sudo command -> sudo ./adafruit-pitft-helper2.sh
  6. and answer the questions
  7.