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

Issues with MATCH ROM Command in DS18B20 Sensor Communication on STM32 Using UART

I am working on reading temperatures from multiple DS18B20 sensors connected to a shared 1-Wire bus on an STM32 NUCLEO-F103RB board. The sensors operate in parasitic power mode, with a 4.7k pull-up resistor on the data line, and I’m using UART in half-duplex mode to emulate 1-Wire communication. I can read data from a single sensor using the SKIP ROM command and retrieve sensor IDs with the READ ROM command. However, when I try to communicate with a specific sensor using the MATCH ROM command, I don’t receive any response. My code :...

How to Expand 10-Bit ADC Signal for 16-Bit SPI Communication Between Two Arduino Unos

hey guys I was working on a project previously where I needed to transmit a 10-bit signal from an analog/digital converter (ADC) to an Arduino Uno using the SPI protocol. Since SPI typically operates with a 16-bit data frame, I need to figure out how to pad or expand the 10-bit signal to fit into a 16-bit frame for transmission. To simulate the ADC, I plan to use a second Arduino Uno as an SPI Master, while the receiving Arduino would act as an SPI Slave. Unfortunately, I only have one Arduino at the moment, so I can’t test my setup yet. I’m also a bit unsure about how to correctly expand the 10-bit signal for SPI transmission. What improvements can be made to ensure reliable SPI communication between the Master and Slave? this is the code I’ve written for both the Master and Slave, but I could use some advice on how to implement the signal expansion and ensure proper communication between the two....

Hard Fault When Using STM32 Nucleo-F446RE with Wiznet W5500 via SPI

I am using an STM32 Nucleo-F446RE with the Ethernet Wiznet W5500 via SPI. The SPI is configured as Master, CPOL = Low, CPHA = 1st Edge, 8-bit data, BaudRatePrescaler = 16. I see correct SPI waveforms on the oscilloscope, but I encounter a hard fault when debugging. I have disabled other SPI modules to avoid conflicts. Here is the relevant initialization code: ```c...

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...