Overly Elaborate I2C Scanner Device

GitHub linke here: https://github.com/CraigMarston/fancy_i2c-scanner

The idea from this project is because I have many cheap I2C devices bought from China via Fleabay or Aliexpress and they arrive with no documentation. To obtain their address I’d previously have to load up an Arduino board with the sniffer sketch, and obtain the address via the serial console on my laptop. This way I can just plug the device in to the reader to obtain its address!!

I2C scanner sketch with a TFT screen to build a standalone device

I2C scanner: Maybe elaborate, but I wanted to use an SPI screen to keep the I2C bus free! This size screen is around the same size as the tiny OLED screens anyhow.

I started off using an Arduino Nano clone, but I can’t be sure the cheap TFT screen is 5V tolerant — although it does have a 3.3V regulator on-board for its supply. I would have needed two 4-channel voltage shifters in this case, so just opted to use an ESP8266 device instead. An Arduino Nano Pro (3.3v) would be ideal for this.

The sketch is built from a basic I2C scanner and I’ve simply added the facility for the SPI screen.

The plan is to put this into a box so it becomes a tool that I can just grab.

Colour codes can be found here: https://github.com/esp8266/Basic/blob/master/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h

Advertisements

Rotary Controller NeoPixel Changer

Link to GitHub here: https://github.com/CraigMarston/rotary_neopixel_changer

C++ project for Arduino Nano / Uno (ATMega328) to control WS2812 RGB LEDs (NeoPixels) with a rotary encoder. Also includes a TFT screen via SPI.

This is my first attempt at using a rotary encoder, and there are many excellent well-written examples available. This one in particular stood out to me: http://www.hobbytronics.co.uk/arduino-tutorial6-rotary-encoder

I have amalgamated many examples, so the majority of this code is not original..!

The rotary encoder is connected to the two hardware interrupts int0 and int 1 of the ATMega328, and the push-button is merely polled. Rotating the device changes the value of a variable which is used to set various parameters. Pressing the button sequences through a ‘case’ function to choose which parameter to change. To add more parameters, this part of the sketch would need altering and most likely refining — something I’d like to see!

The WS2812 LEDs are driven using the HSV conversion, and here is a brilliant explanation: https://www.arduinoslovakia.eu/blog/2018/4/neopixel-ring-hsv-test?lang=en

Also, I’ve stuck with the NeoPixel library rather than FastLED because I want to use RGBW LEDs with this project. They have a fourth white LED which facilitates a wider gamut of colour, including pastel shades — PROPER rainbows!!

The hue parameter for the NeoPixels is 16-bit (0 – 65535) but I’ve used the ‘map’ function to convert 255 steps (twiddles of the rotary encoder!) to cover this much larger value. Now this does mean that a lot of hue values are skipped, but it saves over 65000 twiddles to get round the colour wheel!! Talking of colour wheels: https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-use#hsv-hue-saturation-value-colors-dot-dot-dot-17-41 — this should explain where the numbers come from.

The TFT I used is a generic cheapo 128×128 pixel, slightly wonky one via AliExpress. I connected a different screen and my icons were all displaced vertically. I don’t know if there’s a simple asjustment for this, y’know like you have a desktop computer screen, but I couldn’t find anything with preliminary internet searches…

The colour-space for TFT screens is a right old PITA!!! It’s RGB565 and has four characters representing the 3 channels we’re familiar with. So, greys look like this:

cementGREY 0xBDF7 LIGHTGREY 0xC618 steelGREY 0xE71C DARKGREY 0x7BEF

instead of equal values e.g. 0x555555 or 0xCCCCCC in RGB888. It’s hideous and you’ll need to use an online converter to find your own colours. And they won’t be exact either, just so you know.

Please, please let me know of any improvements you can make as I still consider myself new to this — thanks!

Questionable Feedback Filtering

We bought a cheap booster seat from Halfords as the one we wanted was out of stock (despite their system indicating there should be plenty) and we found it was terrible in our cars.

https://www.halfords.com/kids-zone/car-seats/child-car-seats/halfords-essentials-group-3-booster-seat

I left a review of the seat after returning it to store and buying a much better product;

Unstable; slides around in our cars.

This wasn’t the seat I’d visited the store to purchase, but there was a stock issue so we had to make do. It slipped around on the rear seats in my car (V70), and we assumed it was because they’re leather. It was even worse in my wife’s car (Micra) with fabric seats. It wasn’t as bad in our friend’s Fiesta, but we don’t think it was safe for use in either of our cars. We’ve tried this item with two different children in 3 different cars and think it’s rubbish! Our local store refunded it and I bought a Graco seat instead.

The review has been rejected after moderation and I have replied to Halfords asking them to explain exactly why this is…

Traditional-looking Wireless Doorbell

As we renovate our house, we’re trying to keep everything ‘period appropriate’ where we can. The house was built in the late 30’s, but to an older design plan, so we reckon we have some leeway anyhow..!

Not wanting to drill through the wall to install a traditional doorbell meant we had to use a wireless system; but of course they don’t look the part.

I sourced a bakelite button from t’interweb and then had to figure out how to employ it!

Eventually, I removed the contacts such the the button merely pushes the button on the off-the-shelf wireless transmitter.

I’d wanted to make my own oak patresses using my mate’s watchmaker’s lathe, but the jaws were too small — so I bought some ready-turned off of t’interweb.

Marking out ready for chiselling.

There are some M3.5 captive nuts in the larger (rear) patress. The slotted screws hold both the Bakelite button and front patress in place.

The final assembly prior to being painted with ‘heritage’ paint to keep the theme!

The rear patress was secured to the wall, then the other two components fastened to it. Ta-da!

Make-shift Unicorn HAT Diffuser

I made this from a piece of a flexible ringbinder, that I’d bought at Morrison’s supermarket for 99p!


Initially I thought it’d be a great idea to score the plastic piece I’d cut out, prior to bending:

NOPE!!

The stuff is easy to cut with scissors by the way.

Anyway, to obtain the curve, the panel needs to be slightly longer (by about 5 – 10 mm) than the length of the Unicorn HAT. Best to adjust this to your own personal curve tastes. You’ll need around 3 – 5  mm of material to form the arc* of the folded ends, and then about 8 – 10 mm for the retaining flap which holds it in place. (Mine is more like 11 – 12 mm).


The first attempt after drilling the holes into the retaining flaps — I attached the diffuser underneath the Unicorn HAT. Don’t do this..! 

(Hey if you do, please let me know how you achieved it!!)


Secure the screws to the flaps with nuts & washers as shown in the close-up photo, then you can slot the whole assembly onto the HAT. 

*To form the arc (folding the flaps) just fold the material. I used a pair of pliers, but a bench vice would be perfect. Make several gentle creases so you don’t split the plastic, and you’ll need a slightly sweeping arc anyway, to go around the head of the screw.

I haven’t even tested it yet as it’s disappeared into my son’s bedroom…

Bargain USB Power Supply

Not bad value at a tenner, let alone a fiver!

But, will this bargain from Aldi set my house on fire, or fry everything attached to it? We have some of the first ‘Raspberry Pi Kits’ from Maplin at work, and they came with a Maplin-branded USB power supply. Their output was so raggedy-arsed that the newer Raspberry Pi’s refuse to operate from them!


When I plugged the cable into the power supply there was an almighty ‘CRACK’!! You can see the effects of the sparks — I say sparks because I did it again 😆


Using my ickle handheld oscilloscope, the output (under a slight load) appears to be stable. It certainly doesn’t look like the back of a dragon anyway!!

ZeroPoint • The PiZero-sized analogue gauge for RaspberryPi

​​​​
​​
I excitedly jumped at the chance to review this device as I had the perfect project for an analogue pointer, which was in combination with an experiment I wanted to run. Unfortunately I have been unable to locate particular parts for this experiment so I’ve had to shelve that for now. Grr…
The pHAT has the same footprint as a Raspbery PiZero, although the stepper-motor housing overhangs the PCB by a few mm. This is on the same edge that the PiZero has its connectors on, so I can’t imagine a way that it’d be an issue. Also, it can be used on a full-sized Pi.

Using the test code provided by 4Tronix running on the command line, it’s quite satisfying to keep tapping numbers in, in order to make the needle swiftly and smoothly move! Gareth had also provided some dial templates to get us started.


THIS device is going to be responsible for me learning to code in Python…

Note: the female header is surface-mount not through-hole, SO DON’T just yank it to remove it! Use something like a screwdriver to gently prise along the headers a bit at a time, so as to avoiding bending any pins.


I soldered a right-angled header to my PiZero for mounting it on a breadboard adapter. This also allows the rear of the pHAT board to be seen:


I’m not going to duplicate the technical specifications as they can be found here: http://4tronix.co.uk/store/index.php?rt=product/product&product_id=567

However, my next experiment at home will be monitoring wind-velocity over time, at particular points around our property, and our neighbours’. This is intended to lead to a wind turbine project!! 

Like my neighbour said; even if we only generate enough to charge mobile phones, it’s a start. 

The music in the video was kindly provided by the sickengly talented, and jolly nice JT Bruce • Plunge Into Hyperreality from the album The Dreamer’s Paradox