A C/C++ library for communicating with AMU (Aerospace Measurement Unit) devices over the I2C or USB interface.
This Arduino-compatible library provides a comprehensive interface for controlling and reading data from AMU devices via I2C communication. The library supports multiple AMU devices on the same I2C bus and includes SCPI-based communication capabilities.
- I2C Communication: Full support for communicating with AMU devices over the I2C bus
- Multi-device Support: Connect and control multiple AMU devices on the same bus
- Arduino Compatible: Designed to work seamlessly with Arduino and PlatformIO projects
- SCPI Support: Built-in SCPI (Standard Commands for Programmable Instruments) protocol support
- Measurement Capabilities:
- Voltage measurements
- Current measurements
- Temperature sensor readings (multiple sensors)
- Programmable gain amplifier (PGA) control
- Device Control:
- LED color and pattern control
- Channel activation/deactivation
- Sleep mode management
- Device information retrieval (serial number, firmware version, notes)
- Download this library as a ZIP file
- In Arduino IDE, go to Sketch → Include Library → Add .ZIP Library
- Select the downloaded ZIP file
Add the following to your platformio.ini
file:
lib_deps =
https://github.com/the-aerospace-corporation/amulib.git
#include <Wire.h>
#include <amulib.h>
AMU amu;
void setup() {
Serial.begin(115200);
Wire.begin();
Wire.setClock(400000);
// Initialize AMU device at I2C address 0x0B
amu.begin(0x0B);
// Wait for device to be ready
if (amu.waitUntilReady(5000) == 0) {
Serial.println("AMU device ready!");
}
}
void loop() {
// Read voltage
float voltage = amu.measureVoltage();
Serial.print("Voltage: ");
Serial.println(voltage);
// Read current
float current = amu.measureCurrent();
Serial.print("Current: ");
Serial.println(current);
// Read temperature
float temp = amu.measureTSensor();
Serial.print("Temperature: ");
Serial.println(temp);
delay(1000);
}
The library includes several example projects:
- simple: Basic AMU communication and measurement example
- iv_sweep: Current-voltage sweep measurements
- twi_passthrough: I2C passthrough functionality
Each example includes its own platformio.ini
configuration and can be built independently.
begin(uint8_t twiAddress)
- Initialize AMU with I2C addressbegin(uint8_t twiAddress, amu_transfer_fptr_t i2c_transfer_func)
- Initialize with custom I2C transfer functionwaitUntilReady(uint32_t timeout)
- Wait for device to be ready
measureVoltage()
- Read voltage measurementmeasureCurrent()
- Read current measurementmeasureTSensor()
- Read primary temperature sensormeasureTSensor0()
- Read temperature sensor 0measureTSensor1()
- Read temperature sensor 1measureTSensor2()
- Read temperature sensor 2
setActiveChannels(uint16_t channels)
- Set active measurement channelssetLEDcolor(float red, float grn, float blu)
- Set LED colorsetLEDmode(amu_led_pattern_t mode)
- Set LED pattern modesleep()
- Put device into sleep modegetPGA(AMU_ADC_CH_t channel)
- Get programmable gain amplifier setting
readSerialStr()
- Read device serial numberreadFirmwareStr()
- Read firmware versionreadNotes(char* notes)
- Read device notes
- Arduino or compatible microcontroller with I2C support
- AMU device(s)
- I2C pull-up resistors (typically 4.7kΩ)
This library is released under the MIT License. See the LICENSE file for details.
Colin Mann - Aerospace Corporation
Current version: 2.1
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.