howto

Programming a mini game on a RaspberryPi Pico using a 1.14‘‘ LCD screen

#blog #howto #microcontroller #mycropython #rapsberrypi #raspberrypi pico #game #gamedev

I recently bough this 1.14‘‘ LCD screen for the RaspberryPi Pico. This screen not only just fits perfectly onto the Rasperry, you literally just put it over all of the pin headers, it also comes with a little analog pad, up, down, left, right, as well as an A and B button. So it is already kind of a very small handheld gaming device. The Game It is really simple, the player, a little green square on the left side of the screen, can move up and down using the analog pad, and shoot lasers using the A button.

 

Dead Letter Box - How to run a webserver on a RaspberryPi Pico W and use it as a standalone WiFi Accesspoint

#blog #howto #microcontroller #mycropython #rapsberrypi #raspberrypi pico #webserver

We all know the stories of spies placing letters in hidden dead letter boxes during foggy cold november nights to communicate with other spies. Since the year is 2022 now, we will build something like this, but using a RaspberryPi Pico W 2. Basically the Raspberry Pi will act as a WiFi Accesspoint, which you can connect to without the actual need of physical contact with the device. The Raspberry Pi will also run a webserver, which we will use to to read and store messages, for anybody else who knows where the WiFi can be found and also have the password.

 

Howto run Stable Diffusion Text2Image Generator locally on an M1 Mac

#blog #howto #python #tensorflow #ml #maschine learning #keras #text2image #macos

Text2Image generators like Dall-E or Midjourney are the new hot dudes, when it comes to generating images just from text inputs and also sparked some serious discussions about certain professions might getting obsolete, like artists and photographers. To be honest, it is extremly impressive what these generators can do, but on the other hand they do not replace a photographer for your weddding. Nevertheless I absolutly see practical applications for Text2Image generators.

 

A RaspberryPi Pico To-Do board using Micropython

#blog #howto #raspberrypi #raspberrypi pico #python #micropython #electronics #programming #iot #microcontroller

Sometimes I need a little visual hint to do things, especially when it comes to little things that I should do on repeat, like dayli or even multiple times per day. I’m not really someone who does a lot of sport, but I love to go bouldering. In my “best times” I went three times every week. A few weeks ago I injured my left leg and since then I was not able to go to the bouldering gym anymore.

 

Using a Tensorflow/Keras multi-input model and NLTK to train a simple chatbot

#blog #howto #python #tensorflow #ml #maschine learning #keras

In this example we will build a very simple chatbot, which we will train on pre-defined questions and answers. This approach is very simple, but in fact could be used to build a chatbot that allows users to talk about a limited scope. So basically you could use this as a different way for users to search your FAQs or allow users to get information usually found in your service documentation or even your product offerings, opening hours and menu of your restaurant and so on, by simply asking.

 

Using regression to predict house prices using Tensorflow and Keras

#blog #howto #python #tensorflow #ml #maschine learning #keras

In this example we will use the Boston housing price dataset to predict house prices based on several features such as crime rate, local tax property rate and so on. The biggest difference to the previous examples here is that we do not predict fixed classes. This time we predict a continous value. Prequesites This is the third part of my Tensorflow and Keras Sample series. To better understand what is going on here, I highly recommend to read part 1 and part 2 first and then return here to continue.

 

Multiclass classification with Tensorflow and Keras functional API

#blog #howto #python #tensorflow #ml #maschine learning #keras

In the first part of this series we developed a simple binary classification model using Keras' Sequential model class, which is the easiest way of using Keras. Since the Squential model is easy to use, but also limited in what we can do with it, we will use Keras' functional API from now on. That way we can build more complex models for use cases that are not so simple. Allthough in this example we will basically use the functional API to build a model that could also be build using the Sequential model to show how it works on with a very simple example and then use this in upcoming parts of this series to implement more complex usecases.

 

Simple binary classification with Tensorflow and Keras

#blog #howto #python #tensorflow #ml #maschine learning #keras

This is the first of - hopefully - a lot of Tensorflow/Keras tutorials I will write on this blog. In this first - very simple - example I will demonstrate how to use Tensorflow and Keras to train and use a model to predict if an IMDB movie review is positiv or negative. We will use the IMDB dataset for this, prepare the training data, so we can use it to train the model, and finally make predictions on data the model has never seen before.

 

Setup Tensorflow Environment on M1 Mac

#blog #howto #mac #macos #python #apple #tensorflow #ml #maschine learning

Since Apple’s M1 chip is a really good choice for maschine learning at home, but the setup of a Tensorflow environment isn’t exactly straight forward, I thought it would make sense to simplify it a little bit and write a short guide on how to do it. What we need and what the finished solution will look like We need an Apple device with a M1, M1 Pro or Max chip and macOS 12.

 

Raspberry Pi Pico as HID

#blog #howto #raspberrypi #raspberrypi pico #python #circutpython #electronics #programming #iot #microcontroller

Ever wanted to build a custom controller, or a have a few buttons which you could map some shortcuts to? Then the RaspberryPi Pico and a few touch buttons are everything you need. The Pico can be used as a HID (Keyboard, Mouse or MediaController) by using Adafruit’s HID library. The only problem here is that you can not use it using Micropython, but if we setup the Pico to run Circutpython we are good to go.

 

How Hatzel saved my Gameboy

#blog #howto #gameboy #gaming #retro

I own a classic Nintendo Gameboy, a device that hit the consumer market 32 years ago. I was born one year before that. Of course a few more years passed until I got a Gameboy myself. I played Super Mario Land, Tetris and later Zelda: Links Awakening and (of course) Pokemon. Then the device was replaced by various other consoles and PCs over the next decades. Two years ago I rediscovered it and somehow, after all these years, I felt the desire to relive that time in which I sat down to play those games.

 

How to run PostgreSQL on Docker

#blog #howto #docker #postgresql #database #sql #devops

In this how to I will show how to setup a PostgreSQL server on docker, including how to persist data outside of the container, and also how to run PGAdmin in a container as well. In this example I asume that you’ve already got Docker running on your server, if not, set this up first. Install PostgreSQL By default the PostgreSQL container is configured to save its data to /var/lib/postgresql/data inside of the container.

 

How to use a IR photodiode on an Arduino to meassure IR light

#blog #howto #arduino #arduino nano #photodiode #infrared #electronics #programming #iot #microcontroller

Most tutorials I’ve found so far are about 3-pin photodiodes. These are meant to recieve digital IR signals from TV remotes or similar devices. The 2-pin diodes can be used to simply meassure the available IR light. So you could use this to build a distance sensor, if you add a IR LED emitter and then meassure the reflected light, or to meassure the IR light emitted by a natural or artificial light source.

 

Arduino Nano IoT accelerometer data to pitch and roll

#blog #howto #arduino #arduino nano #accelerometer #c++ #electronics #programming #iot #microcontroller

The Arduino Nano 33 IoT comes with a built-in 3-axis acceleromteter. This sensor meassures values for x, y and z acceleration between -1 and 1. If we want to know the actual position in which the sensor is, we need to know it’s rotation on two axis, pitch and roll, in dregress. This two angles could be used then later on to control two servos which rotate an object exactly the same way the sensor is rotated.

 

How to enable RaspberryPi Camera module on Ubuntu

#blog #howto #raspberrypi #camera #ubuntu

I’m running the official Ubuntu for RaspberryPi on a RaspberryPi 4 and wanted to use the RaspberryPi Camera Module. The thing is, this is not as simple as it is on Raspian. So here are the steps you have to perform to use the Camera Module on Ubuntu. Activate Module First of all connect the Camera Module to your RaspberryPi like you always would and boot it up. Next you have to add the magic setting “start_x=1” to your /boot/config.

 

RaspbeeryPi Pico Temperature Light and Logger

#blog #howto #raspberrypi #raspberrypi pico #python #micropython #electronics #programming #iot #microcontroller

On a rainy sunday afternoon I found out that the RaspbeeryPi Pico fits perfectly into a 35mm film box if you cut a little hole for the USB port into the lid. Since my box was a semi-transparent white box, I decided to add some LEDs and build a little temperature sensor, that indicates the current temperature range using either a blue, green, orange or red LED. Build I connected the power pin (long side) of each LED to a GPIO port (green = Pin4, blue = Pin5, orange = Pin3, red = Pin2), of course with a 220 ohm resistor in between, and all the short sides to GND.

 

How to develop on a RaspberryPi Pico using Micropython

#blog #howto #raspberrypi #raspberrypi pico #python #micropython #electronics #programming #iot #microcontroller

A few days ago I got two brand new RaspberryPi Pico Boards and so it is time to build something using this new toy. So let’s talk about what it actually is, how to setup a MicroPython development environment and also build a simple example project to make sure everything works as expected. This one is not like the others I won’t go to much into the specs of this board, since you can read them for yourself here, instead I will focus here on two specific things that set’s this Pi appart from others like it.

 

Automatically sync local folder with remote ftp

#blog #howto #scripting #bash #ftp #automation

As I’ve already mentioned in my article about how this website was built, this website get’s updated every night automatically with content I wrote the day before. To do so I use a cronjob and a little script that get’s the latests version of this website from Github, builds it and then uploads it via ftp. Since mirroring a local directory with a remote ftp directory is a pretty common task, I thought it would make sense to write about how I did it.