DevHeads IoT Integration Server

DII

DevHeads IoT Integration Server

The DevHeads IoT Integration Server accelerates technology engineering by helping pro devs learn, share and collaborate.

Join

seeking-collabs

firmware-and-baremetal

middleware-and-os

edge-networking

pcb-and-analog

jobs

iot-cloud

code-review

devheads-feed

general-dev-chat

How do I resolve the OSError when reading accelerometer data from MPU6050 using MicroPython?

Hello guys am working on a Project Gesture Recognition and Error Handling with MPU6050 Accelerometer Using MicroPython. How do capture and display accelerometer data from the MPU6050 sensor using MicroPython properly, i have made sure that the sensor is properly initialized and the sensor is positioned correctly when reading the values, but still getting the error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mpu6050.py", line 45, in get_accel_data
OSError: Failed to read accelerometer data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mpu6050.py", line 45, in get_accel_data
OSError: Failed to read accelerometer data
...
Solution:
Consider adding a small delay after initialization and using a lower I2C clock speed
attachment 0

How can I resolve system hangs after extended operation on a BeagleBone Black parking assistance sys

hey guys finally completed my project on parking assistance system using a BeagleBone Black running Embedded Linux, VL53L0X time of flight distance sensor to detect the distance to nearby objects and a 0.96-inch OLED display to show the distance and warning messages. And have performed a series of test on it like: - placing an objects at different distances and verifying accurate readings and warnings. - checking the OLED for correct display output - simulating parking scenarios to validate the system’s reliability....

Why does the HAL Tick timer stop incrementing after creating a FreeRTOS mutex in STM32CubeIDE?

I've been working on an STM32 project using STM32CubeIDE 1.11.2 with CubeMX 6.7.0, and I'm testing on the Nucleo-F767ZI board. After creating a FreeRTOS mutex, I've noticed that the HAL Tick timer stops incrementing. Here's what I've done so far: 1. I started a new STM32 project in STM32CubeIDE with all default settings....

Any web dev here to help me with something? I am trying to run an MQTT dashboard

I have some files and I would like to run them, I am simply trying to integrate an MQTT dashboard for an embedded system, here are the files : bundle.js, index.html, main.css, main.js and tailwind.config.js The problem is that I can't run make since the commands are made for UNIX systems. Let me know if you can help me...
Solution:
Nvm solved it running python3 -m http.server 8080 worked

Efficiently Converting and Quantizing a Trained Model to TensorFlow Lite

Hey guys in contiuation of my project Disease Detection from X-Ray Scans Using TinyML, i am done training my model and would like to know the most easiest and efficient method for converting the trained model to TensorFlow Lite for deployment on a microcontroller, i have converted it using TensorFlow Lite's converter to convert it to a .tflite file but dont know if its the best method, and also how can i quantinize it to reduce the model size and improve inference speed
Solution:
Hey @Enthernet Code good job on getting this far with your project, The method you used to convert your model to TensorFlow Lite is perfectly valid and commonly used. However, if you’re concerned about the model size and performance on a microcontroller, quantization is definitely something you should look into. Quantization helps by reducing the precision of the weights and biases, most times from 32-bit floats to 8-bit integers, which reduces the model size and can significantly speed up inference, especially on hardware with limited resources like microcontrollers. You can apply quantization during the conversion process like this:...

Issues Setting Up Zephyr OS on AVR32UC - Board Configuration and Toolchain Errors

hello guys, I'm setting up Zephyr OS on my AVR32UC microcontroller and running into some issues during the initial configuration. I've already installed the Zephyr SDK and set up the toolchain, but when I try to build the project for my AVR32UC board using west build -b avr32uc_board, I get errors related to the board configuration and toolchain paths. Has anyone else faced similar problems with the toolchain setup or missing board definitions? What are some common mistakes to watch out for, a...
Solution:
@Dark AI Thanks I started by cleaning the build environment with west build -t clean, and I also double-checked my toolchain paths and updated the board definitions, and it worked just fine.

Can ESP32-WROVER-KIT handle wake word detection without an audio chip?

Hi everyone, im starting to work with esp32-wrover-kit right now. I'm looking for wake word engine (and speech recognition like Alexa) throught sdcard audio file. But i saw that esp-adf and Skainet framework works only with board with built-in audio chip. Anyone know if is possible to do something like that with my board, or im just wasting time?...
Solution:
@wafa_ath Yes, it's possible to get wake word detection and speech recognition working on your ESP32-WROVER-KIT. You'll just need to add an external audio codec and tweak frameworks like ESP-ADF or Skainet to suit your board. It's definitely doable, but it will take some extra hardware and setup

What could be causing intermittent UART communication failures in my AVR32UC MCU running Zephyr OS?

I'm trying to develop a smart healthcare system using an AVR32UC microcontroller running Zephyr OS. The system uses UART to communicate between the MCU and a central monitoring station. However, I'm experiencing intermittent communication failures, where the data received is occasionally corrupted or incomplete. I suspect the issue might be related to my UART configuration or the Zephyr OS UART driver. I have Verified the baud rate and ensured it's the same on both ends, checked for noise issues on the UART lines, and experimented with different buffer sizes. What could be causing the intermittent UART communication failures? Are there any specific configurations in Zephyr OS that I might be missing to ensure stable UART communication? The UART initialization code is attached....
Solution:
If you dealing with intermittent UART communication issues on a AVR32UC microcontroller running Zephyr OS , you must check your UART setup . Your hardware flow control should be enabled, adjust the buffer sizes, ensure the ISR is running smoothly...
attachment 0

Resolving Deadlocks in ESP32 Robotic Arm Control with FreeRTOS

Hey guys i'm attempting on working on an ESP32 robotic arm control system using FreeRTOS and MQTT, but the system occasionally freezes. I suspect a deadlock between controlArmTask and sendCommandTask. These tasks manage critical arm control logic, including inverse kinematics,, and motor control. ```c void controlArmTask(void *pvParameter) { while (1) {...

How to store and manage ADC values in a 2D array for FFT processing in an FMCW radar system

I am using an FMCW radar to determine the distance and speed of a moving object with an STM32L476 microcontroller. To find the range of a stationary object, I store the ADC values into the "fft_in" array using the "HAL_ADC_ConvCpltCallback" function. I have initialized "is_data_ready_for_fft = 1" as follows: ```c void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc1) { is_data_ready_for_fft = 1;...
Solution:
Yes, precisely!👍 @Sterling As you proceed through each chirp, that will store your {fft_in} array into the matrix row by row. After that, you may examine the matrix to calculate the velocity or any other desired parameter.

Why Does Piping Output to Hexdump Fail for My Assembly printf Function?

Here is a low level debugging tool for an Intel Core i7 12700K system running Ubuntu 22.04 that requires precise control over output formatting. As part of this tool, I'm implementing a custom printf like function in assembly using NASM assembler and GNU Linker. I've encountered unexpected behavior when piping the output of my assembly printf function to hexdump . The output is displayed correctly when printed directly to the terminal, but piping it to hexdump results in no output. From printf.c , output to STDOUT: ``` $ ./printf...
Solution:
@Marvee Amasi The issue you're encountering is due to the buffering behavior of the standard output stream (stdout). In C, the standard library handles the buffering of stdout, which ensures that the buffer is flushed when the program exits or when the buffer is full. However, when you implement printf in assembly, you're bypassing these standard library mechanisms, which can lead to different behavior, especially when piping the output. To make sure that your assembly implementation behaves consistently, you need to explicitly flush the stdout buffer. You can achieve this by using a write system call directly instead of relying on the C printf function....
attachment 0

How can I achieve high-frequency (over 100kHz) data acquisition with an STM32F107VC using SPI

Please how can I achieve high-frequency (over 100kHz) data acquisition with an STM32F107VC using SPI for an ADC while considering limitations of RTOS tick frequency? FreeRTOS seems insufficient, and high tick rates in Keil RTX5 raise concerns. What's the best approach? @Middleware & OS...
Solution:
Sure, DMA is ideal! Here are some key points for configuration: 1. Buffer Size:Choose a buffer size that holds enough samples to minimize data loss at high speeds. Consider factors like ADC sampling rate and desired data acquisition duration. 2. Interrupt Strategy: Configure DMA to generate an interrupt when the transfer completes (or halfway for double buffering). This allows the RTOS to handle post-processing efficiently. ...

How to Implement a 6-Hour Delay in FreeRTOS Task?

I would like to know if i can do vtaskdelay of a period of 6 hours, what is the way to do it. I have a task I wanted to be excuted eeach 6 hours whats is the best way to do it .? Thanks...
Solution:
@youcef_ali vTaskDelay takes the delay period in ticks, you need to convert the 6 hours into ticks based on your system's tick rate. Normally, u'll are to multiply the number of seconds in 6hours with your ticks per second which would result in a very high number and using large value isn't ideal so a better approach would be using a loop i.e 👇 (this is assuming ur tick is 1000/sec) ```c #define HOUR_TICKS (3600000) // 1 hour in ticks void vTaskFunction(void *pvParameters)...

How to Efficiently Transfer Large Data from ISR to Task on STM32F401 with FreeRTOS?

Good day Devs, I am working with an STM32F401 microcontroller for audio acquisition and need to transfer 384 bytes of PCM audio data from an ISR to a task using queues. The queue size currently used for this transfer is 5, but the high frequency of the ISR (8 kHz) seems to be causing data loss due to queue overflow, resulting in noisy audio recordings. Is there a more efficient method to transfer large amounts of data from an ISR to a task??? (The RTOS in use is FreeRTOS, and the ISR is triggered by the DMA callback from the I2S microphone peripheral)....
Solution:
@Sterling It is suggested not to use large code inside the ISR rather than just define a flag and set that flag inside the isr when the flag is set just read those data from the memory and reset that flag Assuming you are using dma peripheral to memory...

Initialize AVR32UC with Zephyr OS for DHT22 Sensor Communication and Resolve Data Fetch Failure

Hey guys, how can I initialize the AVR32UC microcontroller with Zephyr OS to communicate with the DHT22 temperature and humidity sensor, and address the issue of failing to fetch sensor data? I have been able to configure Zephyr OS for the AVR32UC and ensured all necessary drivers are enabled. The DHT22 sensor is connected correctly, and the initial code for reading temperature and humidity data is implemented. However, the microcontroller still fails to fetch data from the DHT22. what could be wrong? here is my code snippet: ```c #include <zephyr.h> #include <device.h>...

Using Google Test for C-Code and mocking C-Modules

I currently face a situation where I have to use Google Test for C-Code. So I am not really able to use gmock to mock C-modules. What I want to do instead is use the CMake build system to choose mocked modules when needed. I want to accomplish that if possible by telling the build system to first search for includes/header files in lets say "path/to/mock/include" and if the regarding header file cant be found there I want it to choose the header file from the "normal" production code path like "path/to/production/include". That I want to do for every target I define. A target will be the test suite for a specific C-module. Normally that should be possible like this: Why do I want to mock? Some of the modules my module under test includes are hardware dependent. ...

What are the best practices for handling priority inversion in FreeRTOS on ESP32?

Hi guys While working on real-time task scheduling and management with FreeRTOS on ESP32 for a wireless communication system, I faced priority inversion and task starvation issues. I observed that lower priority tasks occasionally blocked higher priority ones, causing missed deadlines, missed sensor readings, and unreliable communication. This was evident as higher priority tasks waited indefinitely for resources held by lower priority tasks. What are the best practices for handling priority inv...
Solution:
Yes, I used a mutex as suggested, and it was the first step that @Joseph Ogbonna gave me that made the difference.

How to resolve SSL handshake failure with error code -0x7780 in STM32 SSL client integration?

Hey guys, I am currently working on integrating an SSL client into my IoT project. I've copied the SSL_Client example from STM32Cube_FW_F7_V1.15.0 into my project, and it compiles successfully. However, the SSL handshake fails with the error code -0x7780 (MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE). I would appreciate any guidance on resolving this issue. Below is the console debug output:...
Solution:
You can usually find this information in the server's documentation or by using tools such as SSL Labs' SSL Test. Also, try to verify that your root CA certificates are properly loaded on the client side.

How to convert relative cursor movement to absolute position for BLE HID using Zephyr?

Hey @MCU, MPU & Firmware @Helper Guys, i have a slight logic problem, So i built a BLE HID device using zephyr which tags input from a console and send BLE HID packets to the connected device All well and good...for now The problem arises here, where the HID report is based of the relative position of the cursor, but my client requires a way to give it through Absolute position of a device(Main eg: phone) ...

How to ensure reliable OTA updates with FreeRTOS on ESP32 and handle failures?

Hi guys I'm implementing OTA updates for an ESP32 project running FreeRTOS to add new features and security patches. The update process often fails mid-way with the error message "OTA Update Failed: Incomplete Write," leaving the device in an inconsistent state and non-operational. Integrating OTA functionality with existing FreeRTOS tasks causes system instability, with tasks being interrupted during critical operations. How can I ensure seamless and reliable OTA updates on ESP32 with FreeRTOS?...
Solution:
For Embedded Linux, I use Mender. I know they are working on integration with ESP32 https://mender.io/blog/mender-ota-on-the-esp32-part-1...