The VM205 Oscilloscope and Logic Analyzer, Part 1

1. Initial steps.

On little more than an impulse, I purchased a VM205 Oscilloscope and Logic Analyzer shield off eBay for thirty bucks. My thinking was that if I could reverse-engineer the remote control protocol on a cheap LED ceiling light, I could build some sleazy Teensy hack to control the light colors through HomeAssistant. The VM205 gets its own entry because it’s a project in and of itself, and looks to require some porting, especially if I want to run the latest OS. Fallback, of course, is to run an OS and kernel recommended in the VM205 docs.

The ingredients for this stew are:

  • A Raspberry Pi 3 B+
  • PiOS ‘Bullseye’
  • The Velleman VM205 shield (not a hat, I guess)

Stand up the Pi

Pi setup: Install the latest PiOS Lite: Attempting 64-bit, may not work

Get the repo: I found a c++ library for the VM205 here:
git clone https://github.com/xhargh/VM205.git
Of note: The Velleman VM205 is now the Whadda WPSH206, so search for that too.

Install libsdldev to enable graphical display
sudo apt-get install libsdl2-dev

OK, let’s compile it!

Make fails at include bcm2835.h, so now need to find the correct library. The version of Raspberry Pi OS I used, ‘Bullseye’ uses the pigpio package, so you’ll need that.
pi@logicprobe:~/git/VM205 $ sudo apt install pigpio

Also, you need a way to test it. I used this:
wget https://abyz.me.uk/rpi/pigpio/code/gpiotest.zip
Which is a simple command line utility to probe the GPIO pins. In fact, that whole site is great:
https://abyz.me.uk/rpi/pigpio/index.html

Now to see if it compiles when this library is included. Nope.

Yeah, not so much.

This just became an exercise in porting the VM205 library to pigpio, away from the old BCM library supporting the bcm2835 chip.

The Software

The VM205 software was originally written in Pascal. I haven’t messed with Pascal since the days of my lighting design internship with Mike Hooker back in the early 90s. Mike’s office partner Dean wrote an electrical load flow analysis app called EDSA in Pascal and tried, very patiently, to teach me data structures and logic in Pascal, but I sucked at it then, and I’ll probably suck at it now.

Since then, I’ve picked up some C and C++, so the port referenced on GitHub is where I’ll start.

Initializing SPI

In the Need to set SPI mode, channel, baud rate in spiOpen(). TODO:

  • Map expected VM205 SPI requirements to spiOpen(channel, baud rate, flags). Find header or src defining SPI flags
  • Find pigpio equivalents for clock_divider, BIT_ORDER_MSBFIRST

References

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.