Skip to content

Instantly share code, notes, and snippets.

@dglaude
Last active December 31, 2023 15:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dglaude/c4db2978a3505a4eb6dbabf85b7884dd to your computer and use it in GitHub Desktop.
Save dglaude/c4db2978a3505a4eb6dbabf85b7884dd to your computer and use it in GitHub Desktop.
Projects logs of David Glaude based on twitter post

Thermal Camera and Circuit Python

Source code: https://gist.github.com/dglaude/2d21262b1c776e7279f39258876d32d6

IoT with Circuit Python

  • 2019/12/07 Feather nRF52840 Express transmitter for the "Circuit Playground Bluefruit Ornament Proximity" demo

BLE hide and seek. Hide: Feather nRF52840 Express Seek: Circuit Playground Bluefruit Express https://twitter.com/DavidGlaude/status/1203450247688654848?s=20

  • 2019/11/30 Cheerlight for PyGamer + AirLift FeatherWing

Using the AirLift to provide access to online API on a Adafruit PyGamer running Circuit Python. https://twitter.com/DavidGlaude/status/1200775886980681729?s=20

Retro Computer

  • 2019/11/03 Reusing a Commodore 64 keyboard with a Raspberry Pi

Bare metal emulation on the Pi, no instruction yet: https://twitter.com/DavidGlaude/status/1191038319473364992?s=20

pico 8

  • 2019/08/23 Pico 8 on a little screen with joystic and button

https://twitter.com/DavidGlaude/status/1164665482290577411?s=20

Some gap to fill since 2018/07/15 and those Thermal Camear experiment

Thermal Camera

(1) I use 'fbi' to display black background in the top left 256*256 pixel of the frame buffer.

(2) I use the @Pimoroni Themal Camera MLX90640 and run in loop a modified version of the 'interp' software provided. It capture the thermal information in I2C and push that in the console Frame Buffer in 256*192.

(3) I use a modified version of fbx2 ( https://github.com/dglaude/Pi_Eyes ), the @adafruit tool to display on two TFT LCD display using the Snake Eyes Bonned. But my modification makes that it only display on one TFT and capture the top left 256256 of the frame buffer to render on the 128128 TFT screen using SPI.

So the resulting usefull image is 128*96 but has been scaled up and down. This is a totally creazy implementation, that use the frame buffer where it is not necessary and downscale an already upscaled image (just because I was lazy to change much more the fbx2 code. To make it really portable, I should power that by LIPO and reduce the size of the assembly (that is currently without soldering, just hack and friction connection).

  • 2018/07/15 Thermal camera displaying on a big 6464 RGB Matrix. It use the above camera from @pimoroni, but this time the @adafruit RGB Matrix Bonnet to display on a HUB75 6464 Matrix. Once again, to go from the camera to the screen, I use the frame buffer, just because code to do that was available. See video here: https://twitter.com/DavidGlaude/status/1018235330447708161

(1) I use a modified version of interp display on my prefered size with a low FPS on frame buffer.

(2) I use rpi-fb-matrix to copy the frame buffer on Matrix.

(3) One trick is that both the Snake Eyes Bonnet and the camera use GPIO4. But on the Snake Eyes Bonnet, it is best to replace GPIO4 by GPIO18, so I connect them on the board, but I also had to make sure GPIO4 was not connected between the bonnet and the Pi.

(4) Also the Matrix require a lot of CPU to be refreshed at high FPS, and this is affecting the proper reading on the I2C camera. The main reason could be the mono processor Raspberry Pi Zero. So to make this work, I had to reduce the FPS at wich image are capture by the camera and the FPS of display on the Matrix. The result is off poor quality with frequent freeze. To really do this would require upgrading the Pi or fixing the code to avoid overhead and directly read from one and push on the other one without the frame buffer in between. Anyway, the 3224 image read is display in 6448 on the RGB Matrix. So nice for display, but not very portable.

64*64 Matrix Display

(1) I used rpi-fb-matrix to copy from my framebuffer (displayed on an old VGA screen with an HDMI to VGA adapter) to the Matrix. And on the console, I display Pico8 in full screen. The big problem is that this is upscale then downscale, and rpi-fb-matrix want to respect the aspect ratio, so despite the fact that Pico8 is 128128 and my matrix 6464, the aspect ratio of Pico8 is lost. But the effect is impressive, almost playable.

(2) So the trick to be pixel perfect, is to display Pico8 in 128*128 on the top left of the screen/frame buffer. And then tell rpi-fb-matrix to only take pixel perfect copy of the screen from the top left. Of course this only display one quarter of the Pico8 screen, the top left quarter.

(3) So as I did not order four 6464 RGB Matrix to daisy chain, the best solution was to find a 6464 game on Pico8, and I found the obscure game micro-society ( https://www.lexaloffle.com/bbs/?tid=3214 ) that @TRASEVOL_DOG did for the #lowrezjam (maybe 2016 edition). Then you need to convince Pico8 to display that in 64*64 on the top left of the screen, and there you can play the game on the Matrix. I am not sure it is pixel perfect, but it is playable (if you consider micro-society to be playable).

This was an epic adventure, and with a big investment of four 64*64 matrix display, this could be a gigantic

Some gap to fill after end of 2017

This seems like a perfect fit. The colour from the various LED to get melanged, but you still see more of the closest LED, so some effect are possible.

After watching a few video from Tony D and Lady Ada, I was a bit frustrated with my attempt at IR. Then I found the library from Chris Young http://tech.cyborg5.com/2017/06/06/announcing-irlibcp-a-circuit-python-module-for-infrared-transmitting-and-receiving/ The Circuit Playground Express I use is for developper, that lib and everything else is beta, but it works for me. My code is here: https://gist.github.com/dglaude/f1d79015217f20951922e20a1139379b

This is using demo code that come with Blue Dot. Nothing special except the fun of controling the robot.

Nothing fancy, just checking that the Blue Dot library was working with the PocketCHIP. That code was writen for the Raspberry Pi, but any decent Linux seems to do the trick.

The code is now publish on github: https://github.com/dglaude/Blue-Dot-Colour-Picker Initially there was no way to turn off the LEDs, then I implemented double_click. Now I am using the recently added when_double_pressed event. The Blue Dot Colour Picker now work on a wide range of RGBs LEDs device such as: unicorn HAT, unicorn pHAT, mote stick, Sense HAT and of course Blinkt!

By request I adapted the TIX clock code for a square 8*8 set of RGB LEDs. This tweet is about the Sense HAT The code pull request has been integrated on https://github.com/mdoege/PyTIX

By request I adapted the TIX clock code for a square 8*8 set of RGB LEDs. This tweet is about the unicorn HAT (does not work with the unicorn pHAT) The code pull request has been integrated on https://github.com/mdoege/PyTIX

When you enter the room (in Minecraft world) the light turns on (in the real world room). For that example, I used the free Raspberry Pi version of Minecraft that has a Python API. I acquired the knowledge to interface from Python to Mincraft from the book "Adventures in Minecraft": http://eu.wiley.com/WileyCDA/WileyTitle/productCd-111894691X.html I acquired the to control IKEA Tradfri light from Pimoroni learn blog: https://learn.pimoroni.com/tutorial/sandyj/controlling-ikea-tradfri-lights-from-your-pi

This is a software/hardware mix project. From an hardware point of view, it is just a matter of connecting the mote stick from Pimoroni to the PocketCHIP. The mote stick interface is microUSB and it is provided with a microUSB to microUSB cable. So the trick is to use a microUSB breakout board that give access to the 4/5 pins. Also connecting pins to the PocketCHIP without soldering is possible because the hole are on purpose not perfectly aligned. From a software point of view this is just a matter of using the spidev python library on the PocketCHIP. This is possible because Rasp.io InsPiRing library use SPI to control APA102 https://www.kickstarter.com/projects/raspitv/raspio-inspiring-connect-rgb-led-shapes-sculpt-you There is really nothing special about this projet, it is just a proof of concept.

There are a few tricks in this project. The Blinkt! library from Pimoroni is done to drive the 8 APA102 Blinkt! where the Mote stick I control is having 16 APA102. The Blinkt! library does bit-banging of the GPIO on the Raspberry Pi, but on the PocketCHIP it must be replaced by CHIP_IO

The Blinkt! from Pimoroni is nice but short, where a Mote stick is double the size with same APA102 RGB LED. The trick is to physically connect the Mote stick on the same GPIO pin as the Blinkt! Then the example available for Blinkt! need to be adapted to be more flexible to other number of LED. To drive simultaniously a Blinkt! and the Mote stick the mini black hat hack3r is used. The longer the rainbow, the more nice it look.

This project did not get traction despite it's originality. The PokemonGo Plus is a BT device that peer with Pokemon Go on your mobile phone. When there is a Pokemon or a Pokestop nearby, it blink a color, you then have to push the button to try to catch the Pokemon or ressource. So the trick here is to put the PokemonGo Plus into the dark, into a box and put a light detector and a servo. Then in a separate box, I placed an ESP8266 program in microPython. The code detect light, push on the button then wait for 10-15 seconds. The result is working, but because the servo and the ESP8266 are powered from the same Lipo, the servo can get stuck on the button or refuse to move. But it give very good result and might not be against the rules of Niantic.

I was affraid to solder on the GPIO pins from my PocketCHIP, and I wanted to test RTk.GPIO portability. So I took Blinkt! library and modified it to use the RTk. This is easy and possible because Blinkt! library does bit-banging on the GPIO. There was just a little discrepency that needed to be fix for the code to work.

I wanted to test the RTk.GPIO with an hardware not officially supported. My pocketCHIP was a good choice. I also used my very first add-on for Raspberry Pi, the Fish Dish(?)

My doorbell was already very customised with an MP3 player sounding a song when someone ring (and potentially opening the door based on an on/off button with red/green LED status indicator). But I wanted to have a Rasbperry Pi contraling that to enhance the possibility. Also because recharging the MP3 Doorbeel was an anoyance. I went for the Pimoroni Automation HAT to be able to open the door when needed. The audio output is taken from the 3,5 mm jack, so I took an battery powered speaker for the sound. But the big trick to avoid noise and having to recharge the battery is to only power the speaker when needed. So replaced the ON/OFF switch of the speaker by one of the relay from the Automation HAT. To play sound, I have to trigger the relay (and play and MP3 or else). Latter I added a mote stick to the setup to be able to have visual indication and sound-less ring (maybe during the night) Nowdays when someone ring the bell, it play 30 seconds of music, while making rainbow on the mote stick and it logs the time in a text file. Next step will be to text me (SMS) or contact me via Twitter or Telegram (with a bot) Also I plan to control the light above the entrance and turn it on when someone ring, but only if it is the night (not based on a light sensor, but based on the time of the day and sunset or sun dawn time for my geographical location)

PocketCHIP make it a great portable terminal for time and place where you don't want to us a laptop. It work great at powering the RaspberryPi Zero

This is totally untested project and serve as a storage for Raspberry Pi Zero. I already know that I will hit limitation on the number of USB device supported if I put a Raspberry Pi as host of this solution.

Here the Blinkt, the Scroll pHAT and the Unicorn pHAT. Not sure what worked or not. I guess Neopixel and APA102 were a success but Scroll pHAT required to write a library for I2C.

Nothing special here, just trying ways to make nice use of mote stick.

This should be used with the traffic light, but 4 wires is what is needed for an I2C bus in LEGO.

First use of that trick to connect the mote stick to other electronics

This was requested by my little girl that wanted a portable version of the TIXclock I did on the Raspberry Pi. ESP8266 (HUZZAH) powered by a Lipo, with a RTC does the trick.

I believe this was done on a Raspberry Pi in Python as a way to test my code before porting to microPython

I ported the TIXclock to another kind of hardware. The colour filter is a nice trick to enhance the usefullness of the Scroll pHAT.

This include a test to know how much time my rainbow can run on the LIPO Battery

Using the ESP IoT pHAT from Pimoroni without any Raspberry Pi an driving pHAT and HAT (and Blinkt!) in microPython. Maybe the first project with ESP8266 that made my decide to invest in HUZZAH and other.

The TICclock is not running on a Raspberry Pi, but on my MAC in Python.

Discovering what is possible in microPython on ESP8266 using APA102

A nice way to have light in more direction, all the Blinkt! display exactly the same thing. This is part of an IKEA hack as it is on the base of an IKEA lamp.

This is an IKEA hack as it use a FADO Lamp. There is an interesting ambiant way to indicate the status of the Minecraft server and the number of connected users.

This is based on counting the number of man in space or similar example.

Reusing ZeroView hardware to do a "weather proof" camera.

Fitting a Raspberry Pi and a Unicorn HAT into a Sprida lamp is easy and non destructive. The effect on the ceiling is great. DISCO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment