Skip to content

shakir-abdo/ch32v003j4m6-libraries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

CH32V003J4M6 Libraries

License: MIT Platform: CH32V003

Over the past few weeks, I've been experimenting with the CH32V003J4M6 microcontroller and have written some basic yet useful libraries. These libraries are thoughtfully created to make your life easier by providing straightforward functions for various peripherals and sensors.

Motivation

The CH32V003J4M6 microcontroller is a powerful and cost-effective solution for a wide range of applications. However, developing software for this microcontroller can be challenging due to the lack of comprehensive libraries and documentation. This repository aims to bridge that gap by providing well-documented and easy-to-use libraries that simplify the development process and help you get the most out of the CH32V003J4M6 microcontroller.

Microcontroller Overview

CH32V003J4M6 Microcontroller

Pin Mapping

CH32V003J4M6 Pin Mapping

Libraries

Core Infrastructure

GPIO Library

Arduino-style GPIO library with comprehensive pin management for CH32V003J4M6.

  • Features: pinMode, digitalRead, digitalWrite, analogRead, analogWrite (PWM), pin reservation system, 10-bit ADC, 8-bit PWM, error handling with detailed codes
  • GitHub: CH32V003J4M6 GPIO Library

Sensors

ADXL345 Library

3-axis accelerometer library with GPIO integration for conflict prevention.

  • Features: Configurable measurement ranges (±2g to ±16g), raw and converted readings, power management, GPIO pin reservation, comprehensive error handling
  • GitHub: CH32V003J4M6 ADXL345 Library

MPU6050 Library

Complete 6-axis IMU (accelerometer + gyroscope) interface with temperature sensing.

  • Features: 6-axis motion sensing, temperature readings, configurable ranges, digital low-pass filter, power management, standard printf support
  • GitHub: CH32V003J4M6 MPU6050 Library

AHT10 Library

Lightweight temperature and humidity sensor library with fixed-point arithmetic.

  • Features: I2C communication at 400kHz, one decimal precision, timeout protection, simple API, efficient memory usage
  • GitHub: CH32V003J4M6 AHT10 Library

MLX90614 Library

Non-contact infrared temperature sensor library with GPIO integration.

  • Features: Ambient and object temperature reading, I2C bus monitoring, GPIO library integration, configurable I2C speed
  • GitHub: CH32V003J4M6 MLX90614 Library

AS5600 Library

12-bit contactless magnetic rotary encoder for precise angle measurement.

  • Features: Rotation tracking with unlimited rotations, direction detection, magnet status monitoring, 0.088° per step resolution, non-blocking design
  • GitHub: CH32V003J4M6 AS5600 Library

Actuators & Output

Servo Library

RC servo motor control with GPIO integration and flexible pin support.

  • Features: Hardware PWM (50Hz), angle control (0-180°), dual servo support, Arduino-compatible API (attach/detach), comprehensive error handling, GPIO pin reservation
  • GitHub: CH32V003J4M6 Servo Library

WS2812B RGB LED Library

Addressable RGB LED strip control with flexible pin assignment.

  • Features: Any GPIO pin support, global brightness control, RGB and HSV color spaces, up to 16 LEDs, GPIO integration, predefined colors, direct bit-banging
  • GitHub: CH32V003J4M6 WS2812B Library

Buzzer Library

Buzzer control with hardware and software PWM support.

  • Features: Active and passive buzzer support, musical note definitions, hardware and software PWM methods, simple tone API, no timer conflicts with software PWM
  • GitHub: CH32V003J4M6 Buzzer Library

Input

Rotary Encoder Library

Quadrature rotary encoder with flexible pin configuration and GPIO integration.

  • Features: Configurable pin assignment, pre-defined configurations for I2C/PWM compatibility, optional switch support, position tracking, direction detection, comprehensive error handling
  • GitHub: CH32V003J4M6 Rotary Encoder Library

Memory Storage

AT24C32 EEPROM Library

I2C EEPROM (32Kbit/4KB) with automatic page boundary handling.

  • Features: High-level API for common data types, automatic page handling, 128 pages × 32 bytes, I2C address auto-detection (0x50-0x57), GPIO pin reservation, comprehensive error codes
  • GitHub: CH32V003J4M6 AT24C32 Library

Internal EEPROM Library

Flash-based EEPROM emulation with multi-instance support.

  • Features: 16-bit and 32-bit variables, string storage, 32 variable capacity, CRC16 verification, wear leveling, backup/restore, comprehensive error handling, GPIO integration ready
  • GitHub: CH32V003 EEPROM Library

Power Management

Deep Sleep Library

Comprehensive power management with GPIO integration and multiple wake sources.

  • Features: SLEEP mode (~600µA), timer and external interrupt wake-up, combined wake modes, millisecond precision, wake source detection, GPIO pin reservation, tested hardware requirements
  • GitHub: CH32V003J4M6 Deep Sleep Library

Communication

DFPlayer Mini Library

MP3 module control via UART for audio playback.

  • Features: Playback control (play, pause, stop, next, previous), 31-level volume control, 6 EQ modes, folder playback, playlist management, device selection (SD/USB), memory efficient (~3.6KB flash)
  • GitHub: CH32V003J4M6 DFPlayer Library

Author

Shakir Abdo

License

All libraries are released under the MIT License.

About

Some basic yet useful libraries for CH32v003j4m6 micro-controller.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors