Not too hot not too cold, Building a surface area temperature reader.

Posted: 06/03/2023 | Edited: 06/03/2023


TLDR; Building my first embedded system to assist me in getting the perfect temperature for my derrrbs (iykyk not explainin' it). This post just goes over my adventure in building it from my process, struggles, & open source contributions I made along the way to get it working.

Hardware

Software


Writing Rust For The Arduino Uno R3

A Hardware Abstraction Layer (HAL) is needed to run Rust on AVR microcontrollers and other common boards.

We need to use the nightly build of the Rust compiler, & can't use Rust's standard library or even a main f(x) as we are running on bare metal (no Operating System).

#![no_std]    // no standard library
#![no_main] // no main function

Instead of using a main f(x), we will use a macro from the Hardware Abstraction Layer to specify our entry point f(x):

#[arduino_hal::entry]

Importing Rust Compiled Binaries To The Arduino Uno R3

  1. List open USB ports: lsusb
  2. Set the serial com port for ravedude: export RAVEDUDE_PORT=/dev/ttyUSB1
  3. Upload the program to the board's flash memory: cargo run

Soldering the MLX90614 sensor

yo0o pretty hard, actually did it so bad it short circuits my board when connected lol.

round 2, bought new sensor and did an ok enough of a job soldering it, so it no longer short circuits the board :)

Connecting MLX90614 sensor to board

Using jumper cables and breadboard I connected the sensor.

Pins:


Software abstraction layer for the MLX90614 sensor

So I found a Rust crate for my exact sensor, but quickly realized it relies on 32 bit floats, and floating point operations on bare metal are not fun lol & to make things worse AVR has a lot of bugs with floating point OPs.

Contributing To The MLX9061x Rust Crate


Adding as fahrenheit feature to my own custom fork


TODO:


idk copyright or whateva Ⓒ 2023 Antonio Hickey