Code for the Hall Effect Current Sensor

A project log for Toyota Camry Hybrid Glow up To Save The World

That's right, the Toyota Camry Hybrid is going to save the world. Don't believe me, follow along as an old 2007 transforms into awesome.

sciencedude1990sciencedude1990 03/30/2024 at 18:040 Comments

The code for the hall effect current sensor has been posted on github.  It is a micropython file for executing on a raspberry pi pico w.

The main idea of the code is that a timer executes every 1 millisecond.  Each time the timer executes, it will take an ADC measurement.

There is a simple wireless webserver, so you put the sensor wherever you want, and then ask it to take some measurements, and then download them.

To ask it to take the measurements, you can use a browser and set the URL to ?GO_ADC?

Then, you can get the measurements (256 samples, spaced at 1 millisecond) with ?ADC_VAL?

Then, you can copy and paste into your favorite plotting tool.

I also added a triggering function so that, when activated, it will start taking data if the ADC reading is above or below a threshold (you can ask for the values with ?TRIGGER_HIGH_SET? and ?TRIGGER_LOW_SET?, and set them, for example, with ?TRIGGER_HIGH_SET=25000TRIGGER_HIGH_SET?

The code also supports serving up webpages, pictures, etc.  For example, I created "favicon.ico" (which is just a .png file called favicon.ico that is stored on the raspberry pi pico.