I love the Raspberry Pi Pico with MicroPython

As soon as I heard of the new „Raspberry Pi Pico“ I wanted one! It‘s a microcontroller which is programmable with MicroPython. Since my main coding language is Python and I always wanted to start some little electronics projects I decided to buy some.

Today they came! I got to work and had a look at some online getting started guides on how to upload and run the code. It‘s as easy as pressing the „BOOTSEL“ (Boot Selection) button when connecting it to your Computer - by doing that it‘ll be detected as a kind of USB-Stick.

After making some tiny LED blinking projects I made this:

from machine import Pin, ADC
import utime

blueLED = Pin(2, Pin.OUT)
greenLED = Pin(3, Pin.OUT)
redLED = Pin(4, Pin.OUT)
sensor_temp = ADC(4)
conversion_factor = 3.3 / (65535)

def checkTemp(temp):
    temp = round(temp)
    if temp >= 20 and temp <= 22:
        print("TEMP OK - {0}°C".format(temp))
        blueLED(0)
        redLED(0)
        greenLED(1)
    else:
        print("TEMP NOT OK - {0}°C".format(temp))
        if temp < 20:
            blueLED(1)
            greenLED(0)
            redLED(0)
        elif temp > 22:
            blueLED(0)
            greenLED(0)
            redLED(1)
        
 
while True:
    reading = sensor_temp.read_u16() * conversion_factor 
    temperature = 27 - (reading - 0.706)/0.001721
    checkTemp(temperature)
    utime.sleep(2)

It measures the temperature and indicates it in the following way: Blue LED: Too cold (under 20°C) Green LED: Good (between 20°C and 22°C) Red LED: Too hot (over 22°C)

Again, it‘s relatively simple but I like how quick and easy it was! If you want to try this out, I‘d recommend you to get the Thonny IDE. Also don‘t forget to save your file as main.py on the Pico.

Sources: heise, how2electronics.com

Beware what you install

Lately I’ve used my intermediate Python “skills” and the internet for a little experiment: my friend challenged me to make a little piece of malicious code. We wanted to see, what you can do with a computer just with code samples / docs from the internet and basic programming.

Now I used Python since it’s currently the only coding language I really learned. There are some, if relatively small, limitations to what Python can do with a computer - but still, I managed to spy on his clipboard, keyboard presses, and tasks running. The program could also download a copy to the Windows Autostart folder. With that done the program would automatically start every time the PC starts. Then I sent the data to a server where I could retrieve the logs with an FTP client. There is much more you could do!

Since my code had some dependencies, I used PyInstaller which basically compiles a .exe file from the Python code. That made my program easily installable without needing to install Python, and it’s packages.

This little experiment reminded me to check more frequently what I install and what I have installed. The stuff we did wasn’t anything really bad, but still scary.

Nothing is more sketchy than mining crypto

I‘m on a little mission with a friend: mine Dogecoin. I have to say, the amount of trustworthy instructions, software, and pools is pretty small.

Why mine dogecoin? It‘s difficulty is not that high and we just want to experience a bit. I‘d definitely say, that dogecoin is not just a meme currency.

Have any recommendations or expertise? I‘d love to talk!