Monday, March 9, 2020

Using a Sonoff SV WiFi Wireless Switch

Recently I got a Sonoff SV WiFi Wireless Switch from Amazon to give it a shot. Here is what I received:

As you see this module is somewhat of a "Maker" version with exposed PCB. To make it easier to test I soldered the screw terminals:

Documentation on how to use that module was found using a QR-Code on the package that points to the related mobile app eWeLink

Jumper configuration on this module is critical or you will fry it...


I opted for the default mode and connected a 9v DC power supply to the input. Pairing it was not as easy as it seemed and took me a few tries and only works on 2.4GHz wifi. After that I could turn on and off the relay using the eWeLink app.

I was also able to add the control to GoogleHome on my Android phone, but note that it required you to sign-in and have an account at eWeLink so you might want to check your security and isolate the device on a separate VLAN or something.

One thing I was not able to get to work is voice activation through either my phone or via my GoogleHomeMini. I do have an other Wifi switch that I bought at Walmart that works, but could not get that one to work the same way. I'll probably try again at a later time.

Thursday, March 5, 2020

Using an SSD1306 based OLED display module

I had the opportunity to buy a 0.96" OLED display module from Amazon.

This is a simple monochrome display that can be interfaced to micro-controller such as an Arduino via the i2c bus.

The model I bought came from the GeekStory store but seems to be distributed by DIYMall. Here are some pictures of what I received:

Looking up the specs we see it's powered by a SSD1306 chipset which is supported by the Adafruit SSD1306 Arduino library.

The wiring is quite simple on an Arduino Uno:

  • VCC is +5v
  • GND is GND
  • SCL goes to A5
  • SDA goes to A4 

For testing I simply loaded the ssd1306_128x64_i2c example sketch that came with the Adafruit library. I did have to change the i2C address on line 59 from 0x3D to 0x3C. I compiled and uploaded the sketch to the Uno and voila:

(Note that the flickering you see in the video is just due to my smartphone sampling rate and you don't actually see it on the display)

Nice display for embedded or wearable. OLED means it does not draw a lot of current so it's great for battery powered devices.

With the 4 corner mounting hole (a lot of module maker forget to add these in their designs) it can easily integrate in your mechanical designs.

Monday, July 29, 2019

Who is Andre Courchesne ?

Professional experience
  • 25 years doing various electronic designs, re-engineering or integration
  • 21 years managing IP networks
  • 20 years using Linux for server and desktop applications
  • 18 years doing code at a professional level
  • 18 years using version control as a core key of the software development process(CVS, Git)
  • 16 years of technical support experience (on the phone and in the field)
  • 10 years working mainly remotely while keeping a strong work discipline, professionalism and ethics
  • 6 years experience managing customers projects of up to 5M$/year
Team management
  • 4 years managing a team of 4 1st level support technical
  • 2 years managing a team of 2 2nd level technical and 2 certified engineers
  • Strong believer of the following keys of engineering team management:
    • Daily stand-up and weekly 1-on-1 team management strategies
    • Knowledge sharing
    • Strict versioning using Git
    • Peer code/design reviews
Programming language experience
  • Ruby, C, Perl, Bash, x86 Assembly, PHP, HTML, HTML/CSS/JS/jQuery, Electron just to name a few languages I am deeply familiar with.
  • I use the language I feel will be the best for the task at hand
Hardware platform experience
  • x86
  • Arduino (Atmel)
  • RaspberryPi
  • BeagleBone
  • Onion Omega
  • Anything Linux and open-source
Professional views
  • Information sharing is the key to success
  • GitLab is an essential tool for engineering team management and project management.
    • Don’t work on something if there is no GitLab ticket for it.
    • Use shipit-cli ( so that all merge request are uniform.
    • Rebase and squash to before merge to maintain a clean head
    • Maintain a changeling using Semantic versioning
  • If you develop for Linux use Linux or macOS not Windows.
  • If it exists and it’s open-source and does 80% of what you need why re-invent it ? Add to it, use it and share it when ever possible.
  • Thrive on open-source, share it, embrace it.
  • Automatization for uniformity, avoid snow flakes (Ansible, scripts,…)

Monday, July 22, 2019

Itsycal: A even better macOS clock replacement

In December 2018 I wrote about Day-O ( as an amazing customizable macOS clock replacement.

One thing that bothered by with Day-O was that in dark mode it was really hard to read and the font was pretty small (I must be getting old).

Well the other day while checking if there was any update to it, the author mentioned the dark mode issue and pointed to Itsycal ( as a possible dark mode issue free replacement.

Well it does work and is even more customizable:

As you can see you can have it display the week number and it can even fetch your calendar(s) appointements.

It has a large font mode for old folks like me and has a lot of customizations:

Give is a shot I'm sure you will like it.

Monday, July 15, 2019

Adding an image to your KiCad EDA PCB

Had to add a logo/image on a PCB I recently made. As this PCB exceeded the size of the free Eagle CAD version I decided to give KiCad a try.

I was plesently surprised at how easy it was. Needs a bit getting used to regarding the component to footprint association but works like a charm !


Now about the subject of this blog post: Adding an image to a PCB in KiCad. At first I was sure there would simply be a "Import JPEG/PNG" and that would be it... Well no...

Adding an image is a 3 step process:
  1. Convert your image to a "kicad_mod" library
  2. Add the library to KiCad
  3. Add the image from the library to your PCB
Let's go through these 4 steps using the following jpeg:

Image result for opensource logo
Convert your image to a "kicad_mod" library

You can use the following tool to convert an image to a KiCad library and at the same time resize the image. Unfortunatly you can not resize the image within the PCB editor, so you need to resize it before.

Simply upload the image, select the proper scaling factor so that the image fits on your PCB. In this case I selected a 0.03 scaling factor which generated an image of 24mm x 18mm.

Once you have it as you want (using the "preview" checkbox), simply uncheck it and download the KiCad library file to your project folder.

Add the library to KiCad

In the PCB editor, go to the "Preferences" -> "Manage Footprint Libraries...". From that dialog click on the folder icon:

And select your project folder. This will create a new library entry to the name of your project folder. Click "OK" to close this dialog. The library is now added to KiCad.

Add the image from the library to your PCB

Finally the last part ! From your KiCad PCB editor, click on the "Add footprint" icon and click somewhere in your PCB to bringup the footprint selection dialog.

Scroll down to find your project name and expand to reviel your image part:

Click "OK" and place the image where ever you want on your PCB:

It's not a straight forward process and you will probably have to try it a few times before you have the image you want, but it works.

Wednesday, June 19, 2019

Displaying a MySQL/Mariadb table on a web page using Ruby Sinatra and JS DataTables

My son was working on a project where he needed to display data from a MySQL/Mariadb table on a web page. Having no prior HTML/JS experience he had no clue how to do this.

He already had a Sinatra based API for the same project so I decided to build him a small demo using Sinatra as the backend API and "web server" and JavaScript DataTables as the front-end.

First let's take a look at a simple database with a single table:

CREATE database demo_datatables;
USE demo_datatables;
DROP TABLE employees;
  name VARCHAR(255),
  position VARCHAR(255),
  office VARCHAR(255),
  extn VARCHAR(255),
  start_date VARCHAR(255),
  salary VARCHAR(255)
GRANT ALL ON demo_datatables.* TO my_user@localhost IDENTIFIED BY "my_password";
INSERT INTO employees VALUES ('Tiger Nixon','System Architect','Edinburgh','5421','2011/04/25','$320,800'),('Garrett Winters','Accountant','Tokyo','8422','2011/07/25','$170,750'),('Ashton Cox','Junior Technical Author','San Francisco','1562','2009/01/12','$86,000');

Ok the datatypes used suck and are inappropriate, but this is not the scope here.

Next let's create our Sinatra API (api.rb):

require "sinatra"
require "sequel"
require "json"

mysql_host   = 'localhost'
mysql_user   = 'my_user'
mysql_pass   = 'my_password'
mysql_db     = 'demo_datatables'

# Initialize out database connector and table dataset
db ||= Sequel.connect(
  adapter: 'mysql2',
  host: mysql_host,
  username: mysql_user,
  password: mysql_pass,
  database: mysql_db,
  max_connections: 10
table = db[:employees]

# Data from MySQL
get '/data' do
  a = { |h| h.values }
  { data: a }.to_json

# Page web root (this must be the last method as out pages data is in /)
get '/:name' do
  if File.file?(params['name'])
    send_file params['name']
    "File #{params['name']} does not exists"

As you can see we have a /data endpoint that will fetch the entire content of the table, format it as an array compatible with DataTables.

We also have a catch all endpoint on / that is used as a poor-man web server. It could be made much better but for this demo it makes the point. This endpoint will simply take any file passed as endpoint and if they exist send them over.

We can start this simply by running ruby api.rb. The output should be similar to this:

[root@monitor1 ~]# ruby api.rb
[2019-06-19 19:38:07] INFO  WEBrick 1.4.2
[2019-06-19 19:38:07] INFO  ruby 2.5.1 (2018-03-29) [x86_64-linux]
== Sinatra (v2.0.5) has taken the stage on 4567 for development with backup from WEBrick
[2019-06-19 19:38:07] INFO  WEBrick::HTTPServer#start: pid=19804 port=4567

So our server is running on port 4756. We can easily test out API by running curl -s http://localhost:4567/data:

[root@monitor1 ~]# curl -s http://localhost:4567/data
{"data":[["Tiger Nixon","System Architect","Edinburgh","5421","2011/04/25","$320,800"],["Garrett Winters","Accountant","Tokyo","8422","2011/07/25","$170,750"],["Ashton Cox","Junior Technical Author","San Francisco","1562","2009/01/12","$86,000"]]}6,000"}]}

We see that out endpoint to get the data works.

Let's now create out base HTML file (index.html):

<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="author" content="">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href="" rel="stylesheet">


  <table id="example" class="display" style="width:100%">
        <th>Start date</th>

  <script src=""></script>
  <script src=""></script>
  <script src="script.js"></script>


It's a simple HTML that has the skeleton for a table and fetches the required dependancies from global CDN sources.

And our small Javascript snippet (script.js):

$(document).ready(function () {
    "ajax": "/data"

Again very simple DataTables usage where we will fetch out data from the /data endpoint and have DataTables render in in the table with ID #table.

And let's look at the result:

Not bad for some ~70 lines of code.

Note that this is by no mean secure, failures trap would have to be added and scaleability would have to be evaluated, but it's simple as hell and I hope a good starting point.

Friday, May 31, 2019

Exposition des finissants en génie électrique du Collège Lionel-Groulx - 2019

Et oui encore une fois cette année j'ai assisté aux présentations des projets des finissants en génie électrique du Collège Lionel-Groulx.

Ayant été finissant a ce même collège en 1993 c'est toujours un grand plaisir de revoir certains de mes professeurs et membre du personnel qui sont encore présents.

Moi et mon coéquipier Eric Jarry lors de la presentation de projet en 1993

Cette année a eu droit à 16 projets des élèves en profils Systèmes Ordinees et  en Télécommunications:

Voici quelques photos et vidéo prisent pendant l'événement:

Kasparov 2.0 par Jean-Chrystophe Rasine et Huillaume Marcoux-Legault

CNC Laser par Sergio-Victor Jara et Marc-Antoine Schanck

Revolution par Alexandre Charrier et Matthieu Mafran

Pinball sans fil par Eric Girard et Delmar Valesquez

Bravo particulier a  Guillaume Génier (projet de crayon capteur) et Nicolas Roy (projet Auto-Topo) qui se sont mériter une bourse offert par Hydro-Quebec:

L'utilisation des Arduino et RaspberryPi sont omnipresent dans les projets ainsi que l'utilisation de l'open source tant logiciel que matériel. Il faut plus d'initiative comme celle-ci et une plus grande participation des industries afin d'encourager la relève.

Petit conseil aux équipes de l'an prochain:

  • Planifier chaque étape de vos projets, assurez-vous d'avoir du temps pour chacune de ces étapes. N'ayez pas peur de mettre certains éléments comme non-necessaire et "nice To havent" afin de pouvoir avoir un projet complet à presenter. 
  • Passez moins de temps à faire de la mécanique et plus de temps a l'élaboration, la planification et l'implementation logiciel et électronique. 
  • Mettez vos projets sur Gitlab et faites en la publicité sur les réseaux sociaux (Facebook, Twitter....)