Skip to content

mcuw/esp32-hallsensor-example

Repository files navigation

ESP32 built-in hall sensor example

Description

This is an example how to use the internal hall sensor and to create microcontroller apps with automatized firmware builds for ESP32.

The hall sensor of the Lolin32 pro board detecteds contactless the neodym magnets

Features

  • Uses Platformio
  • Supports multiple firmwares builds with github actions
  • Example code

Prerequisites

Supported boards

If you want to support this project, you can use these affiliate links* ...

Newer board do not have a hall sensor anymore.

Get Started

  1. Login to github

  2. Clone this git repository

  3. Replace the whole content of this README.md file

  4. Implement your application in the src/main.cpp

  5. Comment your new change in the CHANGELOG.md file

  6. Push your changes

git add .
git commit -am "my app"
git push -u origin main
  1. Create a new release to trigger a release with a tag, e.g. v1.0.0

  2. After the CI build, you can find your firmware files under “Releases”. Files with .factory. in the name are meant for the initial flashing via cable. The others are for updates (e.g. OTA) when a factory version is already on the device. The .factory. files also include a pre-installed file system, bootloader, partition scheme, and safeboot partition.

How to flash your microcontroller

Variant A - Online and no need to install an app

Variant B - Visual Studio Code

  1. Select a board in Visual Studio Code

  1. Flash your board

Contribution

Please see CONTRIBUTING.md for details on how to contribute issues, fixes, and patches to this project.

GitHub Actions - Workflow

The release build happens in the build & release workflow: build_release.yml. It creates a release, after creation of a new git tag (named it like v1.0.0).

If you want to test the build on all merge w/o creating a tag then the build workflow is what you looking for: build.yml

Pioarduino

The pioarduino platform supports latest boards like ESP32-C6, ESP32-H2 and ESP32-P4 and others. There is a pioarduino IDE extension which replaces the PlatformIO IDE extension for VSCode.

PlatformIO

PlatformIO is a tool to create microcontroller apps for arduino platforms and compatibles (esp32). You can install the Visual Studio Code extension in the Visual Studio Code IDE.

Python extra_script.py

There is a tiny python script needed to customize the firmware filenames within platformio, see documentation: https://docs.platformio.org/en/stable/scripting/examples/custom_program_name.html

The extra_script.py script gets the platformio env (e.g. lolin32) and the git-tag for the firmware filename. This is required to publish several firmware names in the github artifacts of a release.

CHANGELOG

You can write your changes in the CHANGELOG.md before you create a release. It will be shown under the release page.

Example Release

see Releases on the right sidemenu.

Customize your project

You can reduce and adapt your required boards in the platformio.ini.

Update the CHANGELOG.md file before you are creating a new release. By creating a new git tag you trigger a new release which generate for you the firmwares.

Troubleshooting

Error on build with platformio:

No module named 'intelhex'

Fix:

pip3 install intelhex

Disclaimer

Contribution and help - if you find an issue or wants to contribute then please do not hesitate to create a pull request or an issue.

We provide our build template as is, and we make no promises or guarantees about this code.

About

Testing ESP32 built-in hallsensor

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors