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

Resolving Device Not Found Error for PIR Sensor on ESP32 with Zephyr RTOS

Am working on a a home automation system that controls water pumps and taps based on motion detection using the Zephyr RTOS on an ESP32 microcontroller, how can i properly detect motion using a PIR (Passive Infrared) sensor with the ESP32? this is what i have tried ```c include <zephyr.h>...

Optimizing CAN ISR to Prevent WDT Panics on ESP32-S3 with MCP25625

Hey guys while developing a CAN bus monitoring system using the ESP32-S3, ESP-IDF, and RTOS, I encountered a WDT (Watchdog Timer) panic within my CAN interrupt service routine (ISR) when interfacing with the MCP25625 CAN controller. The error message is as follows: ``` Interrupt WDT panic: isr: 0x40000000, exc: 0, cpu: 0, task: , sp: 0x3ffbc1c0 E (134) interrupt: PANIC: Interrupt wdt timeout on CPU0 (ISR)...

Synchronizing Sensor Data Over CAN Bus with AVR128DA48 and Zephyr

I’ve integrated temperature, vibration, and pressure sensors with the AVR128DA48, and have set up CAN Bus communication running Zephyr. Each sensor is connected to a separate CAN node, and data is being collected. However, I’m having trouble synchronizing the sensor readings. Sometimes, readings from different sensors are out of sync or arrive too late on the CAN network. This is the current code snippet I'm using for CAN data transmission: ``` void send_sensor_data() { struct zcan_frame temp_frame = { .id = 0x101,...

Debouncing Joystick Input for Frequency Control on STM32 NUCLEO-F401RE

I’m using the STM32 NUCLEO-F401RE microcontroller and have programmed a speaker to change frequency when the joystick is pushed up or down. However, I’m encountering two issues: 1. The frequency sometimes changes multiple times when the joystick is pressed, suggesting the ISR is being triggered more than once. 2. Although the InterruptIn object is set to trigger on the rising edge, it sometimes also triggers on the falling edge when the joystick returns to neutral. ...

Improving Gesture Recognition Consistency on ESP32 with TinyML

Hello, I'm working on a gesture recognition project using TinyML on an ESP32 with an accelerometer (MPU6050). My goal is to detect specific gestures (e.g., wave, swipe) using machine learning. I trained a model using Edge Impulse and successfully deployed it onto the ESP32. However, when I run the inference code, I get inconsistent results, and sometimes the output is incorrect even when performing the same gesture. Occasionally, the ESP32 throws the following error: ``` E (1155) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time: - IDLE (CPU 0)...

Implementing Failsafe Mechanism for Firmware Updates on ESP32

Hey guys i am building a custom ESP32-based project (using the ESP32 DevKitC v4 board, with ESP-IDF version 4.4) and want to implement a failsafe mechanism for firmware updates. I've connected GPIO0 to ground via a switch, intending to enter flash mode when the button is pressed and ESP.restart() is called. However, ESP.restart() only restarts the app, ignoring the GPIO0 state. During the restart process, I've captured the following logs and debug messages: "Restarting..." "CPU reset..."...
Solution:
Use the ESP32's RTC_CNTL_SW_SYS_RST register to perform a hardware reset @Daniel kalu , it will check the state of GPIO0 and enter flash mode if it's grounded.

Debugging Issue with OpenOCD on STM32F411 in CLion

I'm using CLion (version X.X) for embedded development on an STM32F411 microcontroller with OpenOCD 0.11.0. While 'build' completes, the debugger fails with the following error: ``` Error executing event examine-end on target stm32f4x.cpu: /usr/share/openocd/scripts/mem_helper.tcl:37: Error: wrong # args: should be "expr expression"...

How can I set variable increments for a rotary encoder?"

Hi guys,, I want to use a rotary encoder with a selected range (for example, from 0 to 200) with varying increments. I came across an example from Matthias Hertel's library (RotaryEncoder-LimitedRotator) that I would like to upgrade by changing the increment from a certain value, but I haven't been able to achieve that.
For example, I would like my value to increment by 0.1 between 0 and 10, then by 0.5 between 10 and 20, and then by 1 from 20 to 200.
Do you have any solutions to propose?
Below is the code that I would like to upgrade....
Solution:
Yh @M M sure that the dynamic increment function actually addresses the issue . We might also want to optimize the getIncrement function by using a single if- else if chain or a switch statement for better readability and performance, especially if the range of increments becomes more complex tho...

How can I reduce false positives in vibration anomaly detection on an AVR128DA48?

I'm still on the project tho where I've installed a vibration sensor to monitor industrial machinery using an AVR128DA48 microcontroller. While my basic anomaly detection code is functioning, ``` if (vibration_data > threshold) { alert();...

What causes HardFault_Handler errors and inaccurate predictions in STM32 air quality monitoring Sys?

I'm developing an air quality monitoring system on an STM32F746 using TinyML. The system uses a temperature, humidity, and gas sensor to predict the Air Quality Index (AQI) via a model I trained and deployed. While the code works, I sometimes get inaccurate predictions, and occasionally, the STM32 throws a HardFault_Handler error. Here’s the simplified inference code: ```c...

Why doesn't my GPIO pin stay high below 200 Hz in my frequency counter code?

I'm using a frequency counter code from Deep Blue Embedded to monitor RPM via a tachometer and trigger a relay when the frequency drops below 200 Hz. However, the output on pin PB14 doesn't stay high at low frequencies (tested between 100 Hz and 500 Hz). The signal on the oscilloscope fluctuates instead of staying steady. Here's the relevant portion of the code I'm working with: ```c while (1) {...
Solution:
The frequency counter might not be reading consistently at lower frequencies.add a small debounce delay or hysteresis to stabilize the pin state. The UART code likely isn't affecting this, but if unused, you can comment it out or disable UART in the initialization code to avoid resource conflicts. For PA0 not working, ensure it's not reserved for other functions, like input capture.

How can I implement a recovery mechanism for CAN Bus errors on the AVR128DA48 to avoid manual resets

I’m encountering error frames on the CAN Bus when two nodes try to send data simultaneously. I’m using the AVR128DA48 microcontroller. Below is my CAN Bus error handling code: ``` void can_error_handler(const struct zcan_frame *frame, void *arg) { if (frame->error_flags) { printk("CAN error: 0x%02x\n", frame->error_flags);...
Solution:
hey guys, I fixed the issue with the system entering Bus Off mode by enabling automatic recovery on the AVR128DA48 microcontroller. Now, the controller automatically recovers after detecting 128 consecutive error-free frames. To make sure it works smoothly, I also added a backup that manually resets the CAN controller if the automatic recovery doesn’t kick in. Here’s the updated error handling code:...

Why is my assembler subroutine for Shellsort not sorting the array when integrated with a C program

In a group work where we are trying to integrate an assembler subroutine for sorting numbers Shellsort with a C program, the sorting algorithm has been tested as a standalone program and works correctly, but we are encountering issues when linking it with the C code. Specifically, the output array contains the original numbers in the same order instead of being sorted. We are passing the pointer to the array through the RCX register, which is the correct method for passing function parameters in Intel 64. Since the C source code was provided by our lead, we suspect there might be an issue in our assembly code. We are using this function signature in the C code to call the assembly routine:```...
attachment 0

Trying to implement a real-time data processing feature using Edge Computing on the AVR128DA48

Still on my project, I’m trying to implement a real-time data processing feature using Edge Computing on the AVR128DA48. The goal is to perform basic filtering on the sensor data ( removing noise from the vibration sensor). Here’s my simple filtering code: ``` int16_t filter_data(int16_t raw_data) { static int16_t last_data = 0; return (last_data + raw_data) / 2;...

Ensuring 16-bit THUMB Instruction Encoding for Code Execution from SRAM on STM32F103

I'm working on a project where I want to execute code from internal SRAM on an STM32F103 as an exercise. My goal is to write some THUMB assembly by hand, assemble it using arm-none-eabi-as, load the machine code into SRAM with OpenOCD's mwh command, set the PC to the beginning of SRAM using reg pc 0x20000000, and step through the instructions. The assembly code I wrote is a simple loop: ```assembly...

Normalizing Input Data for CNN Model in Image Recognition System on ESP32

still based on my project image recognition system that can analyze images of tissue samples, identify malignancies, and predict possible symptoms and causes. How do i train a CNN to accurately identify malignant tissues? My aim is to train a convolutional neural network (CNN) model for image recognition. But I keep encountering the error
ValueError: Input data not properly normalized

ValueError: Input data not properly normalized

...
Solution:
your code should look like ```python import tensorflow as tf from tensorflow.keras import layers, models ...

ESP32 Voice Commands Processed but LED Unresponsive in MicroPython TinyML Home Automation System

Am developing a home automation voice-controlled system using MicroPython and TinyML on an ESP32 microcontroller to recognize specific voice commands ("turn on" and "turn off") for controlling an LED. Why does the LED remain unresponsive even though commands are being processed correctly? Because my Audio data is being received. yet LED does not react to commands. ```python...

ESP32 Camera Module Initialization Failure in Image Recognition System for Tissue Samples

Hey guys , am working on an image recognition system that can analyze images of tissue samples, identify malignancies, and predict possible symptoms and causes. The system will utilize a camera sensor for image capture, an ESP32 for processing, and a machine learning model for image analysis. My aim is to set up the ESP32 with the camera module to capture images, How can i interface the camera module with the microcontroller to capture clear images? Am getting the error Camera initialization failed Here's my code...

Arduino IDE Not Detecting Ports for STM32 Blue Pill on macOS with ST-Link V2

I am using the Arduino IDE to program an STM32 Blue Pill via an ST-Link V2. After following several manuals, I successfully uploaded the blink example to pin C13.Although I can compile and upload code without any issues, the Arduino IDE doesn’t recognize any ports, preventing me from using the Serial Monitor. The following message is displayed: "Not connected. Select a board and port automatically." Despite trying different configurations (e.g., checking board types, and drivers), the software still fails to detect the connection, even though the macOS system report recognizes the ST-Link V2. Has anyone encountered this issue, and is there an alternative way to view the serial output from the STM32? Any tips on troubleshooting this would be greatly appreciated....

Unexpected Memory Value Fluctuations in GDB While Debugging Pointer in x86-64 C Program

In my last question, I misunderstood how GDB interprets memory when using different formats like x/d and x/1wd. After some digging, I realized the issue was related to GDB displaying the same memory contents as both signed and unsigned integers. That cleared up the confusion about the "flipping" values. Funny how I am facing a different issue with pointer manipulation and register inspection. I’m debugging a simple C program where $rbx is pointing to dynamically allocated memory. Here's the setup in my main.c file When I inspect $rbx in GDB, I expect it to point to the buffer and show the correct values as 28 and -5604 for ptr[0] and ptr[1]. When I execute these commands, I get some strange behavior which I logged in bash.txt . Been making use of x86-64, GDB version 10.1...
attachment 0