Question from the Customer:
I am working on an IoT product development. In this project, there are several types of I2C slave sensors including accel, mag, gyro, etc. An algorithm will be running in our application based on this sensor data. What I want to do - simulate the sensor data coming out of sensor to the controller by injecting the pre-collected sensor data via I2C bus.
My question - can I inject a large pool of emulated data via I2C bus to the master controller with the help of python scripts? I searched long and wide for I2C/SPI debuggers that support scripts and the only one I found is the Total Phase Aardvark I2C/SPI Host Adapter. Will you please provide details about using API scripts – and how I can accomplish my goals?
Response from Technical Support:
Thanks for your question! It sounds like you plan to use the Aardvark adapter as an I2C slave and emulate various sensors in your system. This is definitely possible with the Aardvark Software API and in Python (other programming languages and multiple operating systems are also supported).
|Figure 1: Aardvark I2C/SPI Host Adapter|
The Aardvark adapter has the ability to act as an I2C slave, using one I2C address at a time. The Aardvark adapter will respond with one message with a maximum of 64 bytes when the master issues an I2C read command. You can customize the response message via the API before the master issues a read, and then the Aardvark adapter will respond with that message and automatically wrap if there is a request for more than the supplied response.
The Aardvark adapter will always start responding with the beginning of the set response. If you want the response message to change, you can change it by and set an entirely new message via the API. For details about the API, please refer to section 5 of the Aardvark I2C/SPI Host Adapter User Manual.
There may be some system latencies, mainly from the USB subsystem, which results in a “time cost” for each call to the API that gets or sets data on the Aardvark adapter. Set sufficient delays between I2C commands so that you can prepare the Aardvark adapter for the next request. For more information about I2C characteristics, please refer to section 2.3 of the Aardvark 2C/SPI Host Adapter User Manual.
For a more robust and flexible solution, we suggest looking into the Promira Serial Platform. With the appropriate Active Level Application, in your case, the I2C Active - Level 1 Application, as well as the more advanced I2C Active – Level 2 Application, it can easily meet the demands of your project. The Promira platform supports a wider range of speeds for I2C and SPI, and offers integrated level-shifting for working with sensors at lower voltages. In addition, the Ethernet port slows for the control of the platform over long distances, which may be especially useful for testing sensors in remote areas. The Promira Software API is also available for creating the necessary custom applications to test your project.
The following video provides some insight about how the Promira platform supports IoT development.
|Total Phase is Leading the Way to The Internet of Things|
Additional resources that you may find helpful include the following:
- Aardvark I2C/SPI Host Adapter Quick Start Guide
- Aardvark I2C/SPI Host Adapter User Manual
- Aardvark API Documentation
- Promira Serial Platform Quick Start Guide
- Promira Serial Platform User Manual
- Promira API Documentation
We hope this answers your questions. If you have other questions about our host adapters or other Total Phase products, feel free to email us at firstname.lastname@example.org, or if you already own one of our devices and have a technical question, please submit a request for technical support.