Marlin: Plot of Thermistor Curves

I made a handy plot of Marlin thermistor curves to help visualize the difference between different types. If there is any interest, send me a line and I will provide you with the code to generate additional curves.

Additionally, I worked out how to compute the curve of an idealized B 3950 thermistor. Mosaic Industries works out the math in more details, and I have summarized it here.

The temperature in function of resistance.
// assumes beta 3950
celsius_float_t ideal_thermistor_temperature(auto resistance)
	float beta = 3950, Rinf = 0.176323;
	float T = beta / log(resistance / Rinf) - 273.15;
	return T;

celsius_float_t ideal_thermistor_temperature_from_raw(auto raw)
	float resistance = -4700 * (raw) / (raw - 1024);
	return ideal_thermistor_temperature(resistance);

Plotting this idealized equation results in a neat curve that follows very closely the value tables from Marlin (here for B=3950 this corresponds to thermistor type 11).

Posted in Uncategorized | Leave a comment

Delta MK1 Build: Plan for the Base

Posted in Uncategorized | Leave a comment

STM32 “Blue Pill”: Programming the Bootloader with an Arduino

Commonly refed to as the “blue pill”, this development board has great capabilities. The board comes with an empty flash memory, and so it is necessary to load in programs to do anything useful with this device. Thankfully, there is an easy way to do this using a serial port, which an Arduino can provide on its RX/TX pins. There is one caveat, the Arduino’s microcontroller interferes with the serial communication. Connect the pin RST to GND and that should do the trick.

Some Gremlins!

There’s a problem with Arduino Nano boards containing a CH340 chip. If you encounter problems with serial communication, read on. The RX/TX pins on the microcontroller and connected to LED’s that draw away too much of the signal to make it usable. The solution I came up with is to remove the resistors next to the RX and TX LED’s. These indicators won’t light up anymore, a small price to pay for working serial port.

Experimental Setup

Experimental stm32f103 programming setup on a breadboard

Now, in order to boot the programming module on the STM32, set the boot mode to 10, in other words, the jumpers need to be moved around: BOOT0 on, BOOT1 off. On the computer side, run the flash process.

stm32loader -p /dev/ttyUSB0 -e -w FILEPATH-HERE

The output should look a bit like the following.

All that’s left to do is reset the jumpers back to 00 position and your program will run.

Posted in Uncategorized | Leave a comment

(na├»ve) Factorial Function in Cairo

Here is what I came up with.

# Use the output builtin.
%builtins output

# Import the serialize_word() function.
from starkware.cairo.common.serialize import serialize_word

# Naive factorial.

func factorial(n) -> (result):
    if n == 1:
        return (n)
    let (a) = factorial(n-1)
    return (n*a)

func main{output_ptr: felt*}():
    let (y) = factorial(10)
    return ()
Posted in Uncategorized | Leave a comment

Sharing from WSL2 back to Windows Clipboard

You’d think this is easily done in WSL2 with the following command:

xclip -i file.txt -selection clipboard

The method that works in practice is to pass it over to the native windows utility for manipulating the clipboard:

cat file.txt | clip.exe

Posted in Uncategorized | Leave a comment