DIY and Tinkering

Kategorie: Uncategorized (Seite 1 von 2)

Multitasking experiments on the Raspberry Pi Pico

For those interested in multitasking on the Raspberry Pi Pico I wrote a series of articles in which I describe several methods of running more than just one task on a Pico:

Asymmeric Multiprocessing (AMP) Methods:

  • Or you can combine both solutions: One task is running on one core using Pico’s SDK and several other tasks running on the other core with the help of FreeRTOS. Please see SDK Multitasking AND FreeRTOS Tasks
  • On my github site you can also find an inverted example: The SDK task is running on core0 and the FreeRTOS tasks run on core1.
  • Currently there is a branch of the FreeRTOS kernel under development which will allow to run FreeRTSs on both cores (plesase see branch SMP (symmetric multiprocessing) on the FreeRTOS github site), but the comunity will need some time to solve some remaining problems.

All files can be downloaded from my github.

There is Music in the Air

Finally I managed to build my first Bluetooth speaker. Now I am able to listen to music on a high volume while cooking. Yeah. And to my surprise it was pretty easy. And cheap. I bougth a 50 cent amplifier (OEP30Wx2) in China which is able to deliver up to 30 watts. The main work is done by a Bluettoh audio USB dongle, which I bought at Amazon for 3,50 Euro. Additional components I used: a DC/DC decoupler to prevent this anoying sound caused by a ground loop, a 10k logarithmic potentiometer, a step down conventer, a 12V power supply and of course two speakers. I tried Dayton Audio ND-65-4.

Here’s the schematic for the setup:

The hardest part was the wood working. But it really was fun. Here’s the result. Hope you like it:

My First Manufactured PCB

On my way to a automated watering system I made a big step – well, at least a big step for me. After handsoldering 3 (in words: THREE) perfboards I found severe errors on my latest design, which made me realise that with this technique I will not be able to build a circuit in the size I required it to be. So I decided to do my first PCB design and get it manufactured.

With the help of Phil’s tutorial on KiCad I was able to design a circuit in a very good tool. Phil talks in his video about designing the PCB for the production at JLCPCB, but I decided not to go that route and instead find a German manufactured #supportYourLocals. And I found a fab in Germany: Aisler.

I wanted to give you a short summary on my order. Maybe you’ll find it interesting and decide to also get your PCB in a fab outside China.

On a Friday night (23:30 aka 11:30 pm) I uploaded my KiCad project to their website. You don’t have to create gerber files. Aisler works on the KiCad project. I did not expect somebody to work on my order on a weekend and really, except an automatic email saying that they received my order and payment, no reaction came from Aisler during the weekend.

On Monday morning (6:08 am) they send my a mail, telling me that my order hit production. To my surprise my order was planed for shipping on Tuesday the week after. That would mean 7 working days for producing my PCBs. At that stage I doubt that it was a good idea to go that route – the Chinese fabs usually have a turnaround time of about 48 hours. But on Friday Aisler sent me a mail telling that my order was just shipped! Btw, shipping was free. And really, on Saturday my PCBs arrived. That means Aisler only needed 6 days from production, to shipping, to arrival. What a great job! Afaik, the Chinese are faster in producing but if normal shipping is used they are slower.

And the price?

Well, before I tell you the price, I need to tell you some details about my project:

I designed a 2 layer PCB as they are cheapest. As technology I went for through hole, because I never soldered SMT before and I did not want to start with SMT in my first project. As I already tried hand soldering several times, I had all components laying around and wanted to reuse them. Amongst my components was a housing for a fuse. The housing required some long holes in the PCB. That’s why I was not able to order the cheapest layout and had instead pick „Beautiful Boards HD“, which is the second most expensive category. The minimum order size is 3. The size of my PCB is 107 x 72 mm. Aisler charged 29,35 EURO (netto; w/o taxes) but including shipping.

In comparison:

JLCPCB would have charged 23,18 EURO (production 7,16 EUR; shipping 16,02 EUR). JLCPCB claims to produce the boards in 1-2 days, but the finishing quality would have been lower (Lead-free HASL) then Aisler provided (ENIG). As shipping method I would have chosen DHL express priority (4-6 days from China to Germany).
If I would have chosen the same finishing quality, production time at JLCPCB would have been 3 days (according to their website) and the price would have been 37,32 EURO.

To me it was the right decision to go with Aisler and I definitely will order future PCBs there.

Testing my Soil Moisture Sensors

After soldering and some programming it was time to test my soil moisture sensors. My target was

a) to set up a working infrastructure for transmitting data in my local network.

b) to find out if my sensors are water proof

c) to see their behaviour over time


My ESP32 reads both the soil moisture sensor (output: analog voltage) and water level sensor (output: frequency) and sends the values to my network using the MQTT protocol.

A mosquitto broker running on my Raspberry Pi receives the data. A Node Red daemon get notifications from mosquitto and stores the data in a influxdb database. For visualization I use a Grafana instance.

Soil moisture sensor and my baby fig tree
Water level sensor
Visualization of the water level (blue) and the soil moisture level

In the picture above the refills of the water tank are clear to see (blue line). But you can also see that the soil moisture sensor almost always shows a moisture level of 100% . It also does sens major peaks and a lot of noise. It debugged my code for days to find a mistake, searched my circuit designs for errors, but without success. I did not find the error until I gave up and unmounted my setup:

The paint cover of the copper foil got damaged when I stick the sensor into the soil. 🙁

I decided for spray paint because I wanted to keep the cover as thin as possible. Maybe I try either a seconds layer of spray paint or a different method for painting like brushing.

Soil Moisture

Winter in my area is not a snowy winter dream. Maybe that’s why I am not very much into winter. Winter is a season I always wait to pass. While waiting, I prepare for spring. And this spring I want to build a solution for a problem we always have in summer: Our strawberry plants shrivel to death during our summer holidays. So I decided to build a automatic watering machine for them.
My first step is developing a soil moisture sensor. I checked out different implementations and found that capacitive sensors are best as they do not emit unhealthy things into the soil.


Currently I am preparing the bird nest cam. The ESP32 cam can be powered on two levels: On 3.3V or on 5V. In several articles on the web I found the information that the ESP32 Cam does sometimes not work properly when powered on 3.3V. Therefore I decided to power it on 5V. The LiPo cells of my old MacBook deliver 3.7V. So I needed a step up converter also called boost converter.

Recycling old batteries

I found my 2007 MacBook in the attic and took it apart

MacBook 2007

I will try to re-use as many components as possible in my future projects, but first I’ll have to learn more about Apple’s components. I started with the battery. In its case are 6 LiPo cells. Unfortunately two of my cells are damaged, but that means 4 are left for further usage. Currently I am trying to charge them with the help of a TP4056 board and a 6V 200 mA solar panel. But to gather more data, I first needed to build a data logger.


The four remaining cells are in a good condition. It did several tests with them. I will use at least one of them as battery for my ESP32 cam.

Meanwhile I ordered a HDMI board at Amazon (LCD/HDMI-Karte für 12,1 Zoll / 33,8 cm B121EW03 V2 LTN121W3-L01 LTD133EX2X B133EW01 V4). With the help of this board I am able to use the display of my old MacBook as monitor of a Raspberry Pi4. I will build an Magic Mirror with those components.

« Ältere Beiträge

© 2021 Lochnerweb

Theme von Anders NorénHoch ↑