Wednesday 30 March 2022

Adafruit RP2040 QT Trinkey woes and working example

 Having just bought one of these potentially delightful devices, I now find myself in the wilderness of getting started.

I got past Hello World and then thought I would try using the NeoPixel.

https://www.adafruit.com/product/5056

with 'white' buttons

Product is listed as 

Adafruit Trinkey QT2040 - RP2040 USB Key with Stemma QT


Here's how to get started..


#1 load the latest firmware

https://www.adafruit.com/product/5056

with 'white' buttons

circuit python port

https://circuitpython.org/downloads

the only trinkey with PI is

https://circuitpython.org/board/adafruit_qt2040_trinkey/

So lets get the firmware..

You get linked to..

https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/adafruit_qt2040_trinkey/en_GB/

take the top uf2

I used

https://adafruit-circuit-python.s3.amazonaws.com/bin/adafruit_qt2040_trinkey/en_GB/adafruit-circuitpython-adafruit_qt2040_trinkey-en_GB-20220329-07f8ceb.uf2

hold down both buttons then drag the file into RPI-RP2 folder

Now you will need the library

(https://circuitpython.org/libraries)

copy the lib folder over


Eventually I got it working with the following code

# SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries

# SPDX-License-Identifier: MIT

print("hello")

"""CircuitPython Essentials NeoPixel RGBW example"""

import time

import board

import neopixel

#import digitalio

pixel_pin = board.NEOPIXEL

num_pixels = 1

#print(neopixel.__version__, neopixel.__file__)

pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)

pixel.brightness = 0.01

#print(pixel)

ps=0.2

#ps=1

while True:

    #BRG

    pixel.fill((0, 0, 255))

    pixel.brightness = 0.05

    time.sleep(ps)

    pixel.brightness = 0.01

    pixel.fill((255, 0, 255))

    time.sleep(ps)

    pixel.fill((255, 255, 255))

    time.sleep(ps)

    pixel.fill((255, 255, 0))

    time.sleep(ps)

    pixel.fill((0, 255, 0))

    time.sleep(ps)   

    pixel.fill((0, 0, 0))

    time.sleep(ps)

#test = pixel[0].getPixelColor()

#pixel.fill((125, 0, 1))

pixel.show()

#pixel.fill(255,0,0)

#pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.3, auto_write=False)

print("goodbye")




Monday 28 March 2022

Creating the next generation NiteSave - reducing reliance on fossil fuels

Thanks to Nitesave.com founder Mark N hopgood for these plans. This is a work in progress.


Part 1: How to make the NiteSave switch for laptop, raspberry pi and stand alone.

NiteSave is a switch that allows you to really reduce your reliance on fossil fuels. 

Linked with a battery or power wall it uses smart tracking to reduce your fossil fuel consumption in the following ways.


Utilise solar power - even if you don't have panels yourself.

Take advantage of waste energy production

Nitesave powers its batteries when the sun is out and when waste energy is available.


The power of it all lies in a switch with a tracker.


Kit list..

1. PC, laptop or raspberry pi

2. Microcontroller, e.g. 
Adafruit trinkey - https://thepihut.com/products/adafruit-trinkey-qt2040-rp2040-usb-key-with-stemma-qt?variant=40019715784899
~£9 inc. shipping

3. I2C port expander
https://www.hobbytronics.co.uk/pcf8574an-i2c-port-expander

~£6 inc. shipping

4. 3 x spring mount terminals.
https://www.hobbytronics.co.uk/spring-terminal-4?search=4%20pin

~£8 inc. shipping

5. Prototype board
https://www.ebay.co.uk/itm/154352499080

6. 8 channel relay board ( sponsored )
https://amzn.to/3JNy8Kg

Cables.

Mini Micro JST 2.0 PH 4-Pin Connector plug with Wires Cables
~£5.46