Contenido principal

Resultados de

Jerry
Jerry
Última actividad el 22 de Ag. de 2025 a las 10:45

Im using stm32h735g-dk and i was thinking to start model based development using simulink in matlab.
I already done a cluster prototype using touchgfx and stm32cube ide
now i need to shift from cube ide to simulink using same gui is it possible??
If its posssible how will i integrate with simulink
i have already licenced version and stm embedded packages on simulink and embedded coder
can anyone help me with a guidance how to integrate without using cube ide
Harel
Harel
Última actividad el 25 de Ag. de 2025 a las 13:11

Hi,
I have some problem, I want to upload my data that sample rate at 500HZ, every sevral seconds.
My data include 12 bytes, and it measure 500HZ, for example for 15 seconds I coolect 15*500*12 = 84KB.
Can I upload this data to ThingSpeak? It is possible to use with Free acount (I am student and this is my project)
How can help me..
wang
wang
Última actividad el 3 de Ag. de 2025

Is there a hardware support package available for the MP series?
I'm facing an issue where my Thinkspeak graph is not displaying, even though I'm using exactly the same code as my friend. The code works perfectly in their Thinkspeak account, but not on mine. I've checked the API keys, channel settings, and data formats, but everything seems similar. Has anyone else faced this problem, or do you have tips on what to check next? Suggestions are welcome!
Hi!
I'm having trouble sending data to a channel using MQTT. I'm using a program that was working perfectly until just a few days ago, but after making some minor changes yesterday, it stopped working. I’ve also tested it manually using the MQTTX client. If I send data using CURL and GET, it works fine.
It’s a bit strange...
Thankfully,
Ernesto.
Is it possible to create a Simulink model that is independent of specific microcontrollers?
For example, in the model, the STM32 block is used for CAN transmission. But if I want to deploy the same model to an Arduino, I have to replace the STM32 block with an Arduino-compatible one.
So, is it possible to create a custom block or abstraction that works across multiple microcontrollers like STM32, PIC32, and Arduino without changing the hardware-specific block each time?
Hello,
I've successfully tested the Processor-in-the-Loop (PIL) workflow in Simulink using a TI F28069M LaunchPad, following the standard examples provided by MathWorks. The PIL block, code generation, and communication all worked without issues.
Now, I’d like to run a similar PIL setup using the Infineon TLE9879 EVALKIT (based on an ARM Cortex-M0), which is not officially supported by Simulink as a target.
I’m wondering if it’s possible to configure PIL manually or via custom workflows. For example:
  • Can I create a custom PIL target using Embedded Coder?
  • Would I need to port rtiostream manually for communication over UART?
  • Could I somehow integrate with Keil µVision (which I use for TLE9879) to build and run the generated code?
  • Is there a workaround to simulate PIL behavior using a non-supported board?
My setup:
  • Simulink R2024b
  • Infineon TLE9879 EVALKIT
  • Keil µVision 5 + Infineon Config Wizard
  • UART and JTAG interfaces available
The main purpose is to validate control algorithms and measure execution time, not to implement a full HIL system.
Has anyone attempted PIL with a custom or unsupported microcontroller before? Any tips or resources would be greatly appreciated. Thanks in advance!
M. Franco
M. Franco
Última actividad el 9 de Jul. de 2025

Sto tentando inutilmente di salvare il valore dell'enegia che consumo ogni giorno nel field5 di questo canale: https://thingspeak.mathworks.com/channels/2851490 , ma inutilemte in quanto vengono visualizzati sempre e solo 2 dati anche se ho impostato days=30. Ho provato ad aumentare a 365 ma senza variazioni. Come mai?
Joselito
Joselito
Última actividad el 16 de Jun. de 2025

Bom dia se alguém puder me ajudar, meu código abaixo, não estou conseguintdo conectar o meu Esp8266 ao ThingSpeak, o erro tá na conexão. Estou usando o MicroPython e NodeMCU na plataforma Pytohn o sistema operacional Ubuntu 20
# DHT11 -> ESP8266/ESP32
# 1(Vcc) -> 3v3
# 2(Data) -> GPIO12
# 4(Gnd) -> Gnd
import time, network, machine
from dht import DHT11
from machine import Pin
from umqtt.simple import MQTTClient
print("Iniciando...")
dht = DHT11(Pin(12, Pin.IN, Pin.PULL_UP))
estacao = network.WLAN(network.STA_IF)
estacao.active(True)
estacao.connect('xxxxxxx', 'xxxxxxxxx')
while estacao.isconnected() == False:
machine.idle()
print('Conexao realizada.')
print(estacao.ifconfig())
SERVIDOR = "mqtt.thingspeak.com"
CHANNEL_ID = "XXXXXXXXXXXXXXXXX"
WRITE_API_KEY = "XXXXXXXXXXXXXXXXXXXXX"
topico = "channels/" + CHANNEL_ID + "/publish/" + WRITE_API_KEY
cliente = MQTTClient("umqtt_client", SERVIDOR)
try:
while True:
dht.measure()
temp = dht.temperature()
umid = dht.humidity()
print('Temperatura: %3.1f °C' %temp)
print('Umidade: %3.1f %%' %umid)
conteudo = "field1=" + str(temp) + "&field2=" + str(umid)
print ('Conectando a ThingSpeak...')
cliente.connect()
cliente.publish(topico, conteudo)
cliente.disconnect()
print ('Envio realizado.')
time.sleep(600.0)
except KeyboardInterrupt:
estacao.disconnect()
estacao.active(False)
print("Fim.")
*****************************************************************************************************
No shell aparece como resposta:
MPY: soft reboot
Iniciando...
Conexao realizada.
('192.168.0.23', '255.255.255.0', '192.168.0.1', '8.8.8.8')
Temperatura: 29.0 °C
Umidade: 63.0 %
Conectando a ThingSpeak...
Traceback (most recent call last):
File "<stdin>", line 38, in <module>
File "umqtt/simple.py", line 67, in connect
OSError: -2
linha 38 é cliente.connect()
I want to use Simulink for model-based development of the TC3XX series development board, but I am not sure about the development process and toolchain? Is there a free toolchain available for me to use? Do you have a detailed development tutorial?
Md Arif
Md Arif
Última actividad el 14 de Mayo de 2025

FFT

I have a pressure vs. time plot resulting from the input of an elastic wave, which I obtained from an Abaqus simulation. So, I have access to all the data. Now, I want to convert this time-domain graph into a frequency-domain graph using FFT in MATLAB.
I came across a code through ChatGPT, but I’m not fully confident in relying on it. Could anyone kindly clarify whether the formulas used for FFT in MATLAB are universal for all types of signals? Or is there a more effective and reliable method I should consider for this purpose?
Goncalo
Goncalo
Última actividad el 7 de Mayo de 2025

Hi guys!
Im doing a project where i need to simulate a ship connected to the grid. I have a grid->converter AC-DC-AC -> dynamic load. My converter has to keep the voltage consistent and what changes is the current. Can somebody help me?
Christos
Christos
Última actividad el 1 de Mayo de 2025

I have a SG
F1 Starter Kit and I would like some help in order to upload my data (Temp and Humidy) to my channel
Hello ThingSpeak Community,
I have an energy meter sending data of energy consumed in 4 rooms in hexadecimal values to Sigfox and I was trying to decode the payload and route it to ThingSpeak.
All the datas are sent at the same time.
But ThingSpeak only receives 1 of them and plots them.
However, the rest 3 are missing. Is this because I am trying the free version ?
Would the payed version be capable of receiving all the 4 messages ?
Matthias
Matthias
Última actividad el 6 de Feb. de 2025

I noticed recently that my data is no longer updating on thingspeak again. Is there a connectivity issues with thingspeak

Rajendrra
Rajendrra
Última actividad el 6 de Feb. de 2025

my code is as below:
#include "DHT.h"
#define DHTPIN 15 // what pin we're connected to
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
#define THINGSPEAK_API_KEY "1P4RY69D3YMP9R5W"
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
//-----------------------------
#include <ArduinoJson.h>
StaticJsonDocument<200>JsonDocument;
SoftwareSerialmyserial(10, 11);
//-------------------------
float voltage;
unsignedintfrac;
//---------------------
#define ONE_WIRE_BUS 5
OneWireoneWire(ONE_WIRE_BUS);
DallasTemperaturesensors(&oneWire);
floatCelcius = 0;
float Fahrenheit = 0;
//==========================================================================================================
bytesensorInterrupt = 0; // 0 = digital pin 2
bytesensorPin = 2;
// The hall-effect flow sensor outputs approximately 4.5 pulses per second per
// litre/minute of flow.
floatcalibrationFactor = 5.5; //==========================================================we change cal factor 4.5 to 5.5 if not work chnage again(4.5)
//========== 5.5 calibration factor is working efficent then 4.5 , 7.5 ,and 6.5
volatile byte pulseCount;
floatflowRate;
unsignedintflowMilliLitres;
unsigned long totalMilliLitres, tempTotal = -1;
unsigned long oldTime;
//-------------------------------------------------------
intpH_Value;
float Voltage;
//----------------------------------------------------------------------------------------------
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
myserial.begin(9600);
//--------------------------------
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH);
pulseCount = 0;
flowRate = 0.0;
flowMilliLitres = 0;
totalMilliLitres = 0; // ============================================================
oldTime = 0;
attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
sensors.begin();
//------------------------------------------------
/********************GSM Communication Starts********************/
if (myserial.available())
Serial.write(myserial.read());
myserial.println("AT");
delay(1000);
myserial.println("AT+SAPBR=3,1,\"Contype\",\"GPRS\"");
delay(1000);
ShowSerialData();
myserial.println("AT+SAPBR=3,1,\"APN\",\"www\"");//APN
delay(1000);
ShowSerialData();
myserial.println("AT+SAPBR=1,1");
delay(1000);
ShowSerialData();
myserial.println("AT+SAPBR=2,1");
delay(1000);
ShowSerialData();
//---------------------------------
}
void loop() {
// put your main code here, to run repeatedly:
inti;
for (i = 0; i< 20; i++)
{
flow_meter();
}
temperature();
turbidity();
delay(1000);
gsm();
}
voidflow_meter()
{
if ((millis() - oldTime) > 1000) // Only process counters once per second
{
// Disable the interrupt while calculating flow rate and sending the value to
// the host
detachInterrupt(sensorInterrupt);
// Because this loop may not complete in exactly 1 second intervals we calculate
// the number of milliseconds that have passed since the last execution and use
// that to scale the output. We also apply the calibrationFactor to scale the output
// based on the number of pulses per second per units of measure (litres/minute in
// this case) coming from the sensor.
flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
// Note the time this processing pass was executed. Note that because we've
// disabled interrupts the millis() function won't actually be incrementing right
// at this point, but it will still return the value it was set to just before
// interrupts went away.
oldTime = millis();
// Divide the flow rate in litres/minute by 60 to determine how many litres have
// passed through the sensor in this 1 second interval, then multiply by 1000 to
// convert to millilitres.
flowMilliLitres = (flowRate / 60) * 1000;
// Add the millilitres passed in this second to the cumulative total
totalMilliLitres += flowMilliLitres;
// Print the flow rate for this second in litres / minute
/* Serial.print("Flow rate: ");
Serial.print(int(flowRate)); // Print the integer part of the variable
Serial.print("."); // Print the decimal point */
// Determine the fractional part. The 10 multiplier gives us 1 decimal place.
frac = (flowRate - int(flowRate)) * 10;
Serial.print(frac, DEC) ; // Print the fractional part of the variable
Serial.println("L/min");
/* // Print the number of litres flowed in this second
Serial.print(" Current Liquid Flowing: "); // Output separator
Serial.print(flowMilliLitres);
Serial.print("mL/Sec");
// Print the cumulative total of litres flowed since starting
Serial.print(" Output Liquid Quantity: "); // Output separator
Serial.print(totalMilliLitres);
Serial.println("mL"); */
if ( tempTotal != totalMilliLitres ) {
tempTotal = totalMilliLitres;
// displayVolumeOfWater(totalMilliLitres );
}
// Reset the pulse counter so we can start incrementing again
pulseCount = 0;
// Enable the interrupt again now that we've finished sending output
attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
}
//=========================================================================================================================
}
voidpulseCounter()
{
// Increment the pulse counter
pulseCount++;
}
//-------------------------------------------------------------------------
void temperature()
{
sensors.requestTemperatures();
Celcius = sensors.getTempCByIndex(0);
Fahrenheit = sensors.toFahrenheit(Celcius);
Serial.print(" C ");
Serial.print(Celcius);
// Serial.print(" F ");
// Serial.println(Fahrenheit);
delay(1000);
}
//------------------------------------------------------------
void turbidity()
{
intsensorValue = analogRead(A0);
voltage = sensorValue * (5.0 / 1024.0);
// Serial.println ("Sensor Output (V):");
Serial.println (voltage);
// Serial.println();
delay(1000);
}
//------------------------------------------------------------
voidgsm()
{
myserial.println("AT+HTTPINIT");
delay(1000);
ShowSerialData();
myserial.println("AT+HTTPPARA=\"CID\",1");
delay(1000);
ShowSerialData();
StaticJsonDocument<200>JsonDocument;
JsonObject& object = JsonDocument.createObject();
object.set("TE", Celcius);
object.set("TU", voltage);
object.set("WF", frac);
delay(1000);
object.printTo(Serial);
Serial.println(" ");
String sendtoserver;
object.prettyPrintTo(sendtoserver);
delay(1000);
//myserial.println("AT+HTTPPARA=\"URL\",\"https://api.thingspeak.com/update?api_key=\""); //Server address
myserial.println("AT+HTTPPARA=\"URL\",\"https://api.thingspeak.com/update?api_key=\""); //Server address
delay(1000);
ShowSerialData();
myserial.println("AT+HTTPPARA=\"CONTENT\",\"application/json\"");
delay(1000);
ShowSerialData();
myserial.println("AT+HTTPDATA=" + String(sendtoserver.length()) + ",100000");
Serial.println(sendtoserver);
delay(1000);
ShowSerialData();
myserial.println(sendtoserver);
delay(2000);
ShowSerialData;
myserial.println("AT+HTTPACTION=1");
delay(1000);
ShowSerialData();
myserial.println("AT+HTTPREAD");
delay(1000);
ShowSerialData();
myserial.println("AT+HTTPTERM");
delay(1000);
ShowSerialData;
}
voidShowSerialData()
{
while (myserial.available() != 0)
Serial.write(myserial.read());
delay(1000);
}
Bernard P S
Bernard P S
Última actividad el 27 de En. de 2025

Need code to collect data of waterflow sensor using ESP 8266 and to stoe it in ThingSpeak cloud
Ciao a Tutti,qualche mese fa avevo costruito una stazione meteo con un esp32 e vari sensori.
Tutto funzionava, adesso però ho riprovato, e non funziona più. Ho provato a creare un canale nuovo con nuovo ID canale, nuovo ID Client, nuovo Utente (uguale al Client) e nuova Password. si connette (ho inserito un comando se connesso a MQTT scrivi.....) ma non publica i dati.
Non reisco a saltarne fuori, ècambiato qualche cosa?
grazie a tutti
Manfred Kreidl
Manfred Kreidl
Última actividad el 27 de En. de 2025

Hello,
could it be that there is currently is a stability problem with the MQTT-Broker? I can establisth a connection successfully using the MQTTX client (web and win64 installation). I tried all possible ports an connection types. It disconnects all the time after a few seconds of establishing a connection successfully. So it was not possible to subscribe any item. I do not think the problem is in my side... By the way, protocol verision 3.1.1 ist supported, 5.0 not, am I right?
Maybe you could give me a hint,
Best regards,
Manfred
in the below code write is working fine, but read is failing ( 404 error) can you please help me reslove this.
/*
Go to thingspeak.com and create an account if you don't have one already.
After logging in, click on the "New Channel" button to create a new channel for your data. This is where your data will be stored and displayed.
Fill in the Name, Description, and other fields for your channel as desired, then click the "Save Channel" button.
Take note of the "Write API Key" located in the "API keys" tab, this is the key you will use to send data to your channel.
Replace the channelID from tab "Channel Settings" and privateKey with "Read API Keys" from "API Keys" tab.
Replace the host variable with the thingspeak server hostname "api.thingspeak.com"
Upload the sketch to your ESP32 board and make sure that the board is connected to the internet. The ESP32 should now send data to your Thingspeak channel at the intervals specified by the loop function.
Go to the channel view page on thingspeak and check the "Field1" for the new incoming data.
You can use the data visualization and analysis tools provided by Thingspeak to display and process your data in various ways.
Please note, that Thingspeak accepts only integer values.
You can later check the values at https://thingspeak.com/channels/2005329
Please note that this public channel can be accessed by anyone and it is possible that more people will write their values.
*/
#include <WiFi.h>
const char *ssid = "xxxx"; // Change this to your WiFi SSID
const char *password = "xxxxx"; // Change this to your WiFi password
const char *host = "api.thingspeak.com"; // This should not be changed
const int httpPort = 80; // This should not be changed
const String channelID = "2805914"; // Change this to your channel ID
const String writeApiKey = "xxxxxxxxxxxxxxxx"; // Change this to your Write API key
const String readApiKey = "xxxxxxxxxxxxxxxx"; // Change this to your Read API key
// The default example accepts one data filed named "field1"
// For your own server you can ofcourse create more of them.
int field1 = 20;
//int field1 = 20;
int numberOfResults = 1; // Number of results to be read
int fieldNumber = 1; // Field number which will be read out
void setup() {
Serial.begin(115200);
while (!Serial) {
delay(100);
}
// We start by connecting to a WiFi network
Serial.println();
Serial.println("******************************************************");
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void readResponse(NetworkClient *client) {
unsigned long timeout = millis();
while (client->available() == 0) {
if (millis() - timeout > 5000) {
Serial.println(">>> Client Timeout !");
client->stop();
return;
}
}
// Read all the lines of the reply from server and print them to Serial
while (client->available()) {
String line = client->readStringUntil('\r');
Serial.print(line);
}
Serial.printf("\nClosing connection\n\n");
}
void loop() {
NetworkClient client;
String footer = String(" HTTP/1.1\r\n") + "Host: " + String(host) + "\r\n" + "Connection: close\r\n\r\n";
// WRITE --------------------------------------------------------------------------------------------
if (!client.connect(host, httpPort)) {
return;
}
client.print("GET /update?api_key=" + writeApiKey + "&field1=" + field1 + footer);
readResponse(&client);
delay(200);
// READ --------------------------------------------------------------------------------------------
String readRequest = "GET /channels/" + channelID + "/fields/" + fieldNumber + ".json?results=" + numberOfResults + " HTTP/1.1\r\n" + "Host: " + host + "\r\n"
+ "Connection: close\r\n\r\n";
if (!client.connect(host, httpPort)) {
return;
}
client.print(readRequest);
readResponse(&client);
// -------------------------------------------------------------------------------------------------
//++field1;
delay(10000);
}