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.



Laser engraving on a CR-10 3d printer.

Posted on: March 28, 2019, in All3D PrinterLaser

CR-10 3D Printer

A while back I broke down and purchased a 3D printer, I chose the Creality CR-10 Mini. It's bascially the same as a regular CR-10 but not quite as tall and the bed is slightly smaller.

2300mW, 445nm laser

I also purchased a 445nm blue laser module from Banggood to engrave and cut. It is effective in cutting such things as paper, acrylic, cardboard, cloth, plastic and wood up to about 3mm. It will engrave a wide variety of material.

The CR-10 Mini has the following features.

  • Print size:  300 x 220 x300mm
  • Nozzle Diameter: Standard 0.4mm – can use 0.6mm
  • Software: Cura, Slicer3d, Repetier-host
  • File format: stl,obj, gcode
  • Print speed: Normal 60mm/s, Max 100mm/s
  • Filament diameter: 1.75mm
  • Filament type: PLA, ABS, PTEG, TPU, WOOD, Nylon, Carbon fiber, Copper, etc
  • Power requirements: 120VAC, 250W

Interfacing to the CR-10

The laser has a 4 pin or 3 pin connection depending which version you purchase, both will work.  Regardless of which version you get an interface must be built for optimum life of your laser.  I have included the interface here:

CR-10 to Laser Interface

This connects to the part cooling fan port inside your CR-10. 

Mounting on the CR-10

The laser modules normally comes with magnets attached and I printed a laser mount (thanks VE7IT for creating in OpenSCAD) which can be fitted onto the side of the laser  and clipped onto the print head for easy attachment and removal.

Here is the OpenSCAD file: cr-10-mini-laser-mount.scad

If your laser does not come with magnets search google for N50 10x3mm magnets with 3mm hole.

I got mine from Bangood.  Here is a link to a picture of the magnets.

Caution vision damage possible.

Please use the appropriate glasses to protect your eyes. Make sure they are rated for 445nm wavelength. This laser is seriously powerful and can blind you in an instance.

Software and setup

Once you have your laser interface wired up and connected to the printer,  you can start engraving / cutting.

I use the Inkscape Laser Plugin from Jtech Photonics.  I will include links to local copies of the software etc at the bottom of the article. There are a few steps to perform when sending gcode to the printer that will make your life much easier.

  1. Focus your laser.
  2. Setup G92 offsets.
  3. Burn grid onto 3mm plywood for reference.

Focus your laser

Home your print head for all three axes.  G28 is the gcode to send if you do it manually.

Raise your print head to 100mm about the surface and take note of the distance.  Because I use a 9mm piece of plywood I have to raise mine 109mm.

Move the laser out to the center of the bed.  On top of the laser is a lower power button, depress the button and turn on the power.  It’s a good idea to use your glasses just in case it comes on full power.

You may need to remove you glasses to focus the laser at low power.  Turn the focus knob on the laser until you get as small a dot as possible, then turn the power off.

Setup G92 offsets

Since the laser sits offset from the print head it will not start at 0,0 of the X, Y coordinates of the CR-10 Mini.  We must tell the printer before we run the laser where 0,0 actually is.

What this does is specify an offset so the gcode for the laser can actually be created with 0,0 but the printer will move the head to our offset 0,0.  Also if you recall I mentioned to remember the Z or height offset to actually have 100mm above the surface.  For my setup I send this to the CR-10 before every laser job.

Steps to find your offsets.

  • Home your print head
  • With your software, (Octoprint, Repetier-host etc), jog your print head over until it is approximately 1cm in from the edge, on both the X and Y axes.
  • Step in 1mm increments and note down how many there are for each axis.

These are the measurements that I have to use.

G28
G92 X-45 Y-27 Z-9
G0 Z100
M300 S1000 P400
G4 P3000
M300 S2000 P200

The M300 command plays a sound through the speaker and G4 P3000 waits 3 seconds.

Note: Change Z to always maintain 100mm above your engraving surface.

Here is an example:

Once you have this setup you can use my Inkscape laser template that shows the grid in a locked layer.  You will always know where your engraving will start.

Inkscape Laser Grid Template

Download this and put it in your Inkscape Templates folder.  On my Linux system it is in the

~/.config/inkscape/templates/ folder. 

Now open Inkscape and from the menu choose File->New From Template->laser.



Home Assistant component development

Posted on: November 14, 2018, in AllHome AssitantPython

This is my attempt to document the development of a component and binary_sensor platform, for the Home Assistant project.

This is the code you should use to meet requirements to get accepted into HA.
Read the article.



Python driver for the W800rf32 family of X10 RF receivers.

Posted on: October 25, 2018, in AllHome AssitantPython

I recently put a driver up on PYPI for the W800rf32 family of X10 RF receivers from WGL & Associates.
I use this with the following devices:

KR19A
MS16A
RSS13

Here is the github page: W800RF32

This is available to install via PIP:
pip3 install pyW800rf32

All of the logic for the decoding I wrote for the Pytomation project.
Here is an example of using the code, note: very little error checking here.
My reason for doing a PYPI project was to write and include a driver for Home Assistant.



EU1KY Antenna Analyzer

Posted on: September 1, 2018, in AllHam Radio - SDR

This page is a description of the modifications made to the EU1KY antenna analyzer project.
The FAA-450 Antenna Analyzer is an open source project built from STM32-F7 Discovery board. It has the following features:
  • Colour TFT LCD with capacitive touch.
  • HF/VHF(UHF) frequency coverage (500KHz-500MHz.
  • Built-in TDR function.
  • Multiple scanning curves including SWR.

The analyzer uses DSP technology to analyze the sampled signal and derive the their magnitude ratio and phase difference.

Full open source software is available at bitbucket.org/kuchura/eu1ky_aa_v3.

Development is done by cross compiling for the STM32F746 board on windows (Embitz IDE) or linux (makefile with arm-none-eabi-gcc). The generated F7Discovery.bin file is uploaded to the device using ST-Link loader.

ST-Link loader is available from STMicroelectronics. For windows, you will also need to get the STSW-LINK004 utility and STSW-LINK007 drivers.

List of Custom Software Modifications by VE7IT

Modify splash screen to display QSL card.

TDR chart
Splash screen


To replace the splash screen, create a BMP file exactly 480x272 pixels in size.
Place it in the Src/analyzer/lcd/bitmaps folder.
Make sure it is the only BMP file in the folder, then run the bmp2h.py python script.
This will create a logo.h file which will be included in the project when it compiles.

Modify the signal generator screen.
The analyzer can function as a continuous wave signal generator over a frequency range of 500kHz to 450MHz. Signals above 150MHz are actually using the 3rd harmonic of the internal source.

Generator Screen
Reformated Signal Generator screen

The signal levels are low (0.1 to 0.2vpp), but do radiate when attached to an antenna!. Using the generator mode and a frequency counter, one can adjust the internal crystal calibration factor to get the generator accurate within a PPM or so.

Tapping on the frequency display opens an onscreen keypad where a new frequency in kHz may be entered. Steps of plus and minus 500kHz, 100kHz or 5kHz may be activated by pressing the onscreen row of 6 keys under the frequency display.
Several lines of diagnostic information are displayed that can be used to troubleshoot the hardware receivers, the OSL calibration and the VSWR calculation code. One can also perform a screen save to aid in debugging.

Modify the TDR screen to display coax length in metric and imperial units.

TDR chart
TDR scan showing both metric and imperial lengths

Modify the highlighted ham bands to represent the North American frequency ranges available.
See panvswr2.c. Also, modify the SWR panoramic display to position the cursor bar on the point of lowest SWR on the displayed graph.

SWR chart
SWR scan of 6M vertical

Files / Downloads / Links

Free windows IDE for ARM: https://www.embitz.org/.
STMicroelectronics ST-Link software: https://www.st.com/en/development-tools/st-link-v2.html.
Modified project source files: eu1ky_aa_v3.zip (10.0Mb).
You can download John Coppens ON6JC/LW3HAZ excellent Linsmith program from http://jcoppens.com/soft/linsmith/index.en.php
VE7IT linsmith remote control patch: linsmith-remote.patch for linsmith-0.99.28 (19.2kB).
Analyzer kit/assembled supplier: www.elekitsorparts.com



QRP Labs LimeSDR Enclosure.

Posted on: March 27, 2018, in AllHam Radio - SDR

I recently got a LimeSDR board and also bought a QRP Labs case for it. The QRP Labs case brings all the RF connectors out to the front and rear panels and also includes heatsinks for the chips and a case fan.
Assembly instructions are here.

.
Parts list:
    1. 12pcs SMA to U.FL pigtails
    2. aluminium shell bottom (4 holes)
    3. aluminium shell top (fan cutout, 2 holes)
    4. 4 rubber pads
    5. 4 plastic screws
    6. 8 plastic nuts
    7. fan 30x30 5v with mesh
    8. pinheader
    9. heatpad (1pcs, cut later into more pcs)
    10. 6pcs heatsinks (1x + 2x + 3x)
    11. PCB panel (front, rear)
    12. 8 panel screws
    13. 4 bicolor LEDs
    14. 2 LED holders

Software: There are four software packages that I use with the LimeSDR as well as the LimeSuite from Myraid RF.

Users especially Hams should consider the HF mod https://wiki.myriadrf.org/LimeSDR_HF_Performance



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.  



Microscope

Posted on: March 21, 2016, in AllEquipment

Just picked up one of these microscopes for surface mount work.

Features:
  • High quality optical glass elements
  • High definition erect stereo images over a wide field view
  • 2 levels of total magnifications: 10X and 20X
  • Extremely long working distance allows enough operation space
  • 45°inclined binocular head
  • Low heat LED light - harmless for touching
  • Additional flexible lamp holder provided for different lighting angles
  • Ocular tube has diopter adjustment
  • Adjustable inter-pupillary distance to fit anyone's eyes
  • Sturdy small metal boom stand
  • Product GS and CE approved
  • Manufacturer in business 30+ years

Specifications:
  • Model: G22C
  • Head: 45°Inclined binocular.
  • Eyepieces: wide field WF10X/20 and WF20X/10
  • Objective: 1x
  • Total magnification: 10x & 20x
  • Ocular tube has diopter adjustment ±5dp
  • Interpupillary distance: 2-3/16" ~ 2-15/16"(55~75mm)
  • Working distance: 9 " (230mm)
  • Maximum field of view: 3/4" (20mm)
  • Focus adjustment stroke: 1-3/4" (43mm)
  • LED illumination
  • Power supply: 110V/60Hz (US and Canada)
  • Dimension: 18" x 5-1/8" x 15" (46cm x 13cm x 38cm)
  • Net weight: 14 lb 12oz ( 6.7kg)
  • Shipping weight: 17 lb (8kg)



Hue Commander

Posted on: January 4, 2016, in AllHeathkit H8Python

I have released a Linux console, python utility, called "huecmdr.py". You can use it to test various aspects of the Philips HUE lighting system. It runs great in any X terminal as well.

It has the following features:
  • Authenticate your computer with the bridge
  • Ask the bridge to search for newly purchased bulbs
  • List all the bulbs known to the bridge
  • Select a bulb for testing
    • Test various values of
    • RGB colours
    • Colour temperature
    • Hue and Saturation
    • Brightness

This utility is a great way of selecting a value to use in your Pytomation Instance file. You can find the Source on the Pytomation github site.