Categories
Embedded

Back to embedded!

I used to play with electronics as a teenager but then life got in the way and with marriage, kids, running a business etc.

Life at my web design / support agency is no longer as hectic as it used tobe so that gives me a bit more time to think about about I want to learn and get fired up about.

One thing I’ve found is that I’ve been yearning to do more physical things; perhaps as a side-effect of working in the ephemeral digital realm for so long. I’ve been taking on some carpentry projects (very hands on, very rewarding) but back in the tech world, I’ve started playing again with electronics.

Cheap as chips!

In the image below you see my holding a variety of Adafruit Feather running RP2040 chip made by Raspberry Pi.

I find it amazing that you can buy this amount of tech for so little. The breadth of engineering that goes into this little board – it’s amazing.

It’s been a baptism of fire getting back into this tech, even someone who has dabbled in it many years ago, and who comes from a programming background, there is a lot to learn.

A quick list of what I’ve recently learned:

  • Some of the different boards out there (Pi, Adafruit, ESP32)
  • A reminder of how to use a veroboard
  • How to solder (love my new cordless soldering iron!)
  • Python programming

…and that was the purpose really, to start to find out what I need to know, and to take basic steps forward. To use a project as a learning vehicle.

A project

Like with carpentry, it’s wonderful to have the tools, but you need a project to start thinking about things, and to focus on. Otherwise you are just staring at a blank piece of paper blinded by the almost limitless possibilities in front of you.

My first project is a sound toy. The goal it this:

To have a palm sized, rechargeable device, that plays various, stored digital sounds.

Sounds simple but it’s a good case to help learn.

For starters, I started off buying the Raspberry Pi Pico for this project, but it quickly became apparent that even though this was a fairly small Raspberry PI, it was probably too big for my needs. And it was too powerful – not that it being a waste was the killer issue there, it’s just that being powerful meant power hungry and, remember, this was meant to be a battery powered device.

So I’ve put that to one side for now (it will certainly be be used in a future project) and after some research I came across the Adafruit Feather Prop-maker.

This device has a few important advantages over the Pi Pico for this project:

  • It has a built in amp
    I’ll need this to power the speaker, with the Pico, I would need an external amp breakout board (such as the MAX98357A). Having the amp onboard makes my life easier
  • Lower power consumption (as less complexity on the board e.g. this does not have WIFI or Bluetooth, not needed)
  • Built in support for battery packs (again, you’d need another board if it did not)

So, armed with my better fit board, I started again.

ChatGPT is great!

At this point, I should give a nod to ChatGPT. This has been my companion as I’ve been chatting through the project. Explaining what I’ve been trying to do, and bouncing ideas off it. It certainly helped me, for example, find an alternative when I realised the power consumption of the Pi Pico made that tech a non-starter.

AI has been very, very helpful here.

Very helpful as well with talking through how to set up the boards, getting started with an IDE, whether to use CirtuitPython or MicroPython etc. All things that would have been harder (but not impossible) to do with plain, vanilla Google searches.

What I also like abotu ChatGPT is now you can have ‘Projects‘ so I can have an area for all my Raspberry Pi/Embedded stuff. And it remembers what I’m trying to achieve with a project. It’s like having a patient friend with you.

ChatGPT sucks!

However, it’s not all plain sailing. As soon as you get into niche areas like, for example, that for. this project I’m using the Adafruit Feather Prop-Maker, it can forget that it has an amp built in etc.

But the biggest issue were the code examples.

They didn’t work.

Now this is not really a criticism as I didn’t really expect them to fully work. I understood that we had a lot of moving parts here, and this was complex stuff. Having starting point code (even if not working) is a great help.

But the problem was, when things don’t work it’s a binary thing: there was no sound coming out of the speaker. So you have to be able to troubleshoot. Luckily years working in IT has equipped me with those skills.

After a few hours troubleshooting I was getting nowhere and a little downhearted.

Then I started making a few breakthroughs..

I saw (well, heard!) the light..…

Researching the actual tech specs I started noticing issues with the code; where ChatGPT had made assumptions (perhaps based on other RP2040 boards).

I realised that if it was missing steps out, and getting important details wrong, I needed to be be more vigilant with what I was accepting from it.

After a night of troubleshooting (with little to show for it), I woke up with a fresh idea to check the code for pin configuration against the official tech specs. I quickly spotted the mistake* and then, with a huge smile on my face, I finally heard noise come out of the speaker and, a few moments later, my voice (from a quickly cobbled together WAV sample).

(*Actually, I THINK the ChatGPT example code had the wrong port configuration but the right numbers in code comments! Weird!)

So, sorry, I’ve rambled enough now, in a follow up post I’ll chat about my next steps with this project.

Leave a Reply

Your email address will not be published. Required fields are marked *