Wednesday, 7 June 2023

Draw pictures on your Pico!

Would you like to draw pictures on your Pico? 

A while ago I experimented with sketcher - a program for the Rasperry Pi Pico that connected to a Raspberry Pi. The Pico had two potentiometers that you could use to move a virtual pen in the Pi; the Pi ran the turtle graphics package which it used to draw the pictures.

The project was fun, and I wondered how easy it would be to run a similar program that would use a display with the Pico.

That potential project sat in my pending tray for ages, but I recently got an incentive to re-visit it.

A new resource

Pimoroni have asked me to write a booklet for their Pico Explorer Base. I've been a fan of the product since it first came out, and I'm really enjoying a chance to revisit its awesome capabilities.

I decided I'd write a simple sketcher program that ran on the Pico. It uses two potentiometers to move a virtual pen up/down and left/right. The pen draws on the Explorer base display.

I've now got a simple version running, and I intend to enhance it over the next day or so.

Here's the first sample output.

I'd like to claim that it's a carefully designed image of a dog, but it's actually the result of a completely random experiment. The software works, though, and users more dexterous than me should be able to create some more artistic images.

The booklet is still under development, and won't be available for a while, but when it is you'll be able to read about it on Twitter, on this blog, and on the Pimoroni website.

Tuesday, 9 May 2023

ChatGPT Meets de Bono: A Powerful Combo

I'm struggling to make a decision at the moment, so I've enlisted the help of ChatGPT.

I am experimenting a lot with some of the new AI tools, and it's a bit like playing whack-a-mole at the moment; as soon as I get to grips with one bit of software, another appears and demands my attention.

A lot of what I'm doing is based on OpenAI's ChatGPT. I'm concerned that I'll spend too much on paid services, so I am actively looking at Open Source alternatives that I could run locally.

Jetson Xavier dev kit
Alas, many Large Language Models (LLMs) are too resource-hungry to run on my workstation, and I've been thinking of trying out a Jetson Xavier which I'm not using at the moment.

Worth the time?

I know I'll need to spend a few days getting to the point where I know whether I can use it for the projects I have in mind. Should I invest the time?

I decide to take a Judo approach and use ChatGPT to help me make the decision.

I used a prompt that's worked well for me before now. It based on de Bono's Six Thinking Hats.

You've probably come across the Six Thinking Hats technique before, but if not you can read about them on Wikipedia.

The Prompt and Response

Here's my question, along with ChatGPT's response. I've made minor tweaks to the format but the text is unchanged.

I'm thinking of running an LLM as an alternative to ChatGPT on my 16 GB Jetson Xavier developer kit.
Use Edward de Bono's Six Thinking Hats to help me evaluate that idea.


Edward de Bono's Six Thinking Hats is a powerful decision-making tool that encourages looking at a problem or idea from
multiple perspectives. In this case, we'll use it to evaluate running an LLM (Large Language Model) as an alternative to
ChatGPT on a 16 GB Jetson Xavier developer kit.

White Hat (Facts and Information):

  1. The Jetson Xavier developer kit has 16 GB of RAM and a powerful GPU, making it suitable for running AI models.
  2. LLMs typically require significant computational power and memory.
  3. ChatGPT is based on GPT-4, which is also an LLM.

Red Hat (Emotions and Intuition):

  1. You might feel excited about running an LLM on your Jetson Xavier kit, as it could be a challenge and an opportunity to learn.
  2. Concerns may arise about whether the hardware is capable of handling such a large model efficiently.

Black Hat (Critical Judgement):

  1. Running an LLM on a Jetson Xavier developer kit might be limited by the 16 GB of RAM, depending on the size of the model.
  2. Performance and latency might be issues due to the large size of the LLM, affecting real-time applications.
  3. Power consumption and heat generation could be concerns when running a large model continuously.

Yellow Hat (Optimism and Benefits):

  1. Implementing an LLM on the Jetson Xavier kit could lead to a deeper understanding of AI models and their deployment on edge devices.
  2. It could potentially offer better performance compared to smaller models, resulting in more accurate and contextually aware responses.
  3. Developing and optimising an LLM for the Jetson Xavier kit could contribute to the growing AI community.

Green Hat (Creativity and Alternatives):

  1. Consider using a smaller, more efficient model that is optimised for edge devices, while still providing a satisfactory level of performance.
  2. Explore the possibility of using model distillation or pruning techniques to create a smaller model suitable for the Jetson Xavier kit.
  3. Investigate other hardware solutions or cloud-based platforms that may better accommodate the computational requirements of an LLM.

Blue Hat (Process and Summary):

In summary, running an LLM as an alternative to ChatGPT on a 16 GB Jetson Xavier developer kit has its pros and cons.
While it may offer better performance and accuracy, it might also present challenges related to hardware limitations,
power consumption, and heat generation. Consider exploring alternative models or hardware solutions, or optimizing the
LLM for edge devices. Ultimately, the decision will depend on the specific use case and the desired balance between
performance and efficiency.

Not bad for an AI!

I'm impressed by the response, as I have been with other uses of the prompt. I've also used two other de Bono frameworks: Six Value Medals, and Six Action Shoes. You can ask ChatGPT about them.

Pro tip: Make sure you are using ChatGPT 4, as version 3.5 has confused Action Shoes with the Thinking Hats!

The books are less well known but they can form the basis of useful prompts.

You'll also see from the Wikipedia article about Six Thinking Hats that there are recommended sequences of Hat use for tackling particular types of problem. These could form the basis of further useful prompts for ChatGPT.

I'll share more useful prompts as I discover them. You can keep track of them by following me on Twitter at @rareblog.

Monday, 8 May 2023

Finding the Best Solution with ChatGPT: A Personal Experience

When you're developing software for technically savvy users, you'll often encounter an annoying problem: users provide their preferred solution instead of their requirements.

This issue is even more pronounced when you are both developer and user.

In such situations, you're likely to choose the first solution that seems to meet your needs, even though there might be better alternatives.

Pair programming can help, as your partner can spot what's going on and suggest other ideas. But what if you're programming on your own?

That's where ChatGPT comes in handy.

ChatGPT to the Rescue

I've recently been working on an application that downloads interesting arXiv PDFs, and I wanted to access them remotely. I could think of a couple of ways to do that, but I decided to ask ChatGPT for advice. I used a prompt that had been helpful before:

"Suggest three ways I could accomplish that, with the pros, cons, and interesting features of each approach."

I presented my problem: I have a directory containing PDFs on a Raspberry Pi computer, and I want to be able to read the PDF files from Python on another Linux computer.

ChatGPT suggested three approaches, complete with pros and cons for each:

  1. File sharing with Samba
  2. Remote access with SSHFS
  3. Web server with a file browser

I had considered using Samba shares or a web server, but I had forgotten about SSHFS. Since I already had password-less SSH access to the Raspberry Pi, SSHFS was incredibly easy to set up, and it has been working very well.

Reusable Prompt for Problem-Solving

Here's the reusable prompt I mentioned earlier:

"Suggest three ways I could accomplish that, with the pros, cons, and interesting features of each approach."

I now use this prompt whenever I'm trying to find a solution to a problem, and ChatGPT consistently delivers valuable insights.

I'll share more useful prompts as I discover them. You can keep track of them by following me on Twitter at @rareblog.