@felmue Thank you, that makes sense. Btw, a great product.
Posts made by HappyUser
-
RE: Tab 5, how to enable Lora?posted in PRODUCTS
-
Tab 5, how to enable Lora?posted in PRODUCTS
It appears that the tab5 is prepared to work with Lora. Any idea how?
Thanks -
RE: Trying to get this LoRa Module working on Core2posted in Modules
@felmue Dear Felix,
Actually, we have done nearly the same thing.
We have connected this module: HopeRF RFM95W to the connectors on the back of the Core2. That works great.
We have no idea why the LoRa module does not work with the Core2. Maybe a SPI conflict somewhere deep in the background, maybe a power issue or maybe, and more likely, we are lacking some understanding.
Anyway, we have decided to use a Proto board, solder the LoRa module on it and place that on the backside of the Core2.
We have to do that for 35 devices, but it is fail save.
Thanks for all the effort
Regards -
RE: Trying to get this LoRa Module working on Core2posted in Modules
@felmue Thank you.
We are struggling really hard with the M5Unified library. We tried getting things working using startwrite and endwrite at the correct places, and also without using (as you suggested). The problems that we are facing is that sometimes the display lights up after a restart and sometimes it does not. We dont believe it is a faulty device because we se it happening with different M5Core2.We are diving into it. Maybe i will make a new post discribing the problems (and hopefuly solutions) that we are facing with M5Unified.
For now, we dont dare to update our devices in the field because there is no turning back.
Regards -
RE: Trying to get this LoRa Module working on Core2posted in Modules
@felmue Thank you.
Pins are assigned correctly. Double checked.
Not shown but this piece of codeauto cfg = M5.config(); cfg.serial_baudrate = 115200; cfg.output_power = true; cfg.led_brightness=180; M5.begin(cfg); M5.Power.begin();``` Handles the power. Tested out : if we remove M5.Display.startWrite(); then Lora.begin works great. However, we need to startup the display also. So, I strongly beleive there is some interference with SPI and startWrite(). No idea how. Regards Regards -
Trying to get this LoRa Module working on Core2posted in Modules
/*
After some further trial and error and comparison of what works and what not works.
In this piece of code :auto cfg = M5.config(); cfg.serial_baudrate = 115200; cfg.output_power = true; M5.begin(cfg); M5.Power.begin(); M5.Display.startWrite();The problem starts with M5.Display.startWrite(); If we remove that one, LoRa.begin(LORA_FREQ)) works fine.
So I assume that there is some kind of SPI conflict.
Then the next question is : i need to keep both the startwrite because i use M5Unified and I wnat to connect to the Lora module.Is this info a better pointer to find a solution?
Thanks*/
Hi,
We are trying to get this LoRa module : ```
https://docs.m5stack.com/en/module/lora868working in a M5Core2. We realize that this module is no longer supported. But we have a lot of them operational in the field, and for several reasons we need to upgrade from M5Stack the grey on to M5Core2. I have included our testing code. We are using the M5_SX127X.h which works great with the M5Stack grey one. We also updated the pins to the Core2 (when the LoRa module is stcked on the Core 2. This piece of code tells us that SPI is started:if (SPI.begin(LORA_SCLK, LORA_MISO, LORA_MOSI,-1)) // SCK, MISO, MOSI, SS { Serial.println("Fine");} else {Serial.println("Not fine");}We are not sure about this one : LoRa.setSPIFrequency(300000); // Not sure , we tried different values also left this out, to no avail. The software hangs inside this call LoRa.begin(LORA_FREQ) , which looks like the SPI transmission with the LoRa device hangs. But we have no idea. Double checked the pin assignments, we beleive they are correct. Anyone a suggestion how to get this LoRa module working on an M5Core2? Thanks However,#include <arduino.h>
#include <M5Unified.h>
#include <SPI.h>
#include "M5_SX127X.h"#include <Wire.h> //The DHT12 uses I2C comunication.
#include <WiFi.h>
#include <WiFiClient.h>#include <WiFiMulti.h>
#include <HTTPClient.h>#include <EEPROM.h>
#define EEPROM_SIZE 1
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS GPIO_NUM_26 //9
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);// Module Connect Pins Config
// Core
/*
#define CS_PIN 5
#define RST_PIN 26 //13
#define IRQ_PIN 36 //34#define LORA_MISO 19
#define LORA_MOSI 23
#define LORA_SCLK 18
*/
// Core2
#define CS_PIN 33 //5
#define RST_PIN 25 //26 //13
#define IRQ_PIN 36 //36 //36 //34#define LORA_MISO 38 //19
#define LORA_MOSI 23 //23
#define LORA_SCLK 18 //18// LoRa Parameters Config
// #define LORA_FREQ 433E6
#define LORA_FREQ 868E6
#define LORA_SF 12
#define LORA_BW 125E3
#define LORA_TX_POWER 17/*
// Module Connect Pins Config
#define CS_PIN 5
#define RST_PIN 13
#define IRQ_PIN 34#define LORA_MISO 19
#define LORA_MOSI 23
#define LORA_SCLK 18// LoRa Parameters Config
// #define LORA_FREQ 433E6
#define LORA_FREQ 868E6
#define LORA_SF 12
#define LORA_BW 125E3
#define LORA_TX_POWER 17
*///**************************** LoRa
int packetSize;
int LoRa_Pulse_Count_Max=0; // Om de WindGust te bepalen
int LoRa_Counter_Cumm=0;
int LoRa_Windspeed_Counter=0;
float LoRa_Windspeed_Avg=0;float LoRa_Outside_Temperature;
int LoRa_Pulse_Count;
float LoRa_Wind_Speed;
float LoRa_WindGust;const int LoRa_Pulse_Array_size= 400; // inschatting
int LoRa_Pulse_Array[LoRa_Pulse_Array_size];const long Ten_Minutes=600000;
long Next_Ten_Minutes;typedef struct {
int SecretCode;
int Pulse_Count;
int CallCounter;
//float Current;
//float Voltage;
float tempC;} LoRa_Receive_struct;
LoRa_Receive_struct LoRa_Receive_Data;//***************************** End of LoRa
void setup() {
Serial.begin(115200);
//pinMode(CS_PIN,OUTPUT);
//pinMode(RST_PIN,OUTPUT);
Serial.println("LoRa Receiver");
if (SPI.begin(LORA_SCLK, LORA_MISO, LORA_MOSI,-1)) // SCK, MISO, MOSI, SS
{ Serial.println("Fine");} else {Serial.println("Not fine");}
LoRa.setSPI(&SPI);
LoRa.setPins(CS_PIN, RST_PIN, IRQ_PIN); // set CS, reset, IRQ pin
LoRa.setSPIFrequency(300000); // Not sure , we tried different values
while (!LoRa.begin(LORA_FREQ)) {
Serial.println("LoRa init fail.");
delay(1000);
}
Serial.println("Seems okay");//LoRa.setTxPower(LORA_TX_POWER); //LoRa.setSignalBandwidth(LORA_BW); //LoRa.setSpreadingFactor(LORA_SF);}
void loop() {
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet '");
LoRa.readBytes((uint8_t *)&LoRa_Receive_Data, packetSize);
if (LoRa_Receive_Data.SecretCode==5498)
{Serial.print("LoRa :"); Serial.print(LoRa_Receive_Data.tempC); Serial.print(" | "); Serial.println(LoRa_Receive_Data.Pulse_Count); }/*
// read packet
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
*/
// print RSSI of packet
Serial.print("with RSSI ");
Serial.println(LoRa.packetRssi());
}
} -
RE: Core2 and M5Unified display no longer worksposted in Core 2
@felmue
Well, strange behaviour is not seldomly caused by strange root causes.
I already explained that after upload, the program seems to be running normal, only the screen stays dark.
After a lot of trial and error, it seems that it is to do with how the software is uploaded. We are using CH9102 or CP210x (not even sure which one). But the reality is that after uploading, poweing off the Core2, the screen seems to function normal. This is repeated behaviour detected with several M5Core2. Probably we need to upgrade one of the driver. Still hesitating about that because on OSX upgrading can be a risky business. Anyway, it appears to be solved (dont understand it btw).
Regards -
RE: Core2 and M5Unified display no longer worksposted in Core 2
@HappyUser
Further research
Tried the default M5GFX Bargraph example (attached)
No display on M5Stick and M5COre2
Works perfect on M5StickCPlus and M5CoreS3This is realy weird.
I hope someone can help#include <arduino.h> #include <M5GFX.h> M5GFX display; //#include <M5UnitOLED.h> //M5UnitOLED display; // default setting //M5UnitOLED display ( 21, 22, 400000 ); // SDA, SCL, FREQ //#include <M5UnitLCD.h> //M5UnitLCD display; // default setting //M5UnitLCD display ( 21, 22, 400000 ); // SDA, SCL, FREQ //#include <M5UnitGLASS2.h> //M5UnitGLASS2 display; // default setting //M5UnitGLASS2 display ( 21, 22, 400000 ); // SDA, SCL, FREQ // #include <M5AtomDisplay.h> // M5AtomDisplay display; static constexpr size_t BAR_COUNT = 64; static int max_y[BAR_COUNT]; static int prev_y[BAR_COUNT]; static uint32_t colors[BAR_COUNT]; void setup(void) { display.init(); display.startWrite(); display.fillScreen(TFT_BLACK); if (display.isEPD()) { display.setEpdMode(epd_mode_t::epd_fastest); } if (display.width() < display.height()) { display.setRotation(display.getRotation() ^ 1); } for (int x = 0; x < BAR_COUNT; ++x) { prev_y[x] = display.height(); max_y[x] = display.height(); int r=0,g=0,b=0; switch (x >> 4) { case 0: b = 255; g = x*0x11; break; case 1: b = 255 - (x&15)*0x11; g = 255; break; case 2: g = 255; r = (x&15)*0x11; break; case 3: r = 255; g = 255 - (x&15)*0x11; break; } colors[x] = display.color888(r,g,b); } } void loop(void) { int h = display.height(); static int i; ++i; display.waitDisplay(); for (int x = 0; x < BAR_COUNT; ++x) { int y = (h>>1) - (sinf((float)((x-24)*i) / 3210.0f) + sinf((float)((x-40)*i) / 1234.0f)) * (h>>2); int xpos = x * display.width() / BAR_COUNT; int w = ((x+1) * display.width() / BAR_COUNT) - xpos - 1; if (max_y[x]+1 >= y) { max_y[x] = y-1; } else { if ((i & 3) ==0 ) { display.fillRect(xpos, max_y[x]-3, w, 1, TFT_BLACK); max_y[x]++; } } display.fillRect(xpos, max_y[x]-3, w, 3, TFT_WHITE); if (prev_y[x] < y) { display.fillRect(xpos, prev_y[x], w, y - prev_y[x], TFT_BLACK); } else { display.fillRect(xpos, y, w, prev_y[x] - y, colors[x]); } prev_y[x] = y; } display.display(); } -
RE: Core2 and M5Unified display no longer worksposted in Core 2
@felmue said in Core2 and M5Unified display no longer works:
Arduino library v3.2.1,
Dear all.
Thanks
@Felix : what do you exactly mean with Arduino library v3.2.1,?
My settings:
Arduino IDE 2.3.6
M5GFX : 0.2.13
M5Unified 0.2.8
Arduino ESP32 Boards 2.0.18M5Core2 display stays black. I have tried the same software on an M5Stick. Display also stays Black,
Software is running. Serial.print also shows the correct display dimensions.
Tried the software on a M5CoreS3 and the display is responding!!
Tried the software in M5Core2 AWS link text. and the display is responding!So apparantly for the M5Core2 and M5Stick I am missing something. M5CoreS3 works like expected?
Anyone a clue?
I am really grateful.(*As i noticed that the height and widt of the screen are correcty read and the buttons appear to be working, could it be that the backlight is just off?. Mind you, i have ttried on several devices so it is not a failure of one device *)
-
RE: Trying to compile Core example from M5Stack githubposted in Cores
@teastain
Arduino/libraries/M5Stack/src/utility/pngle.c:31:10: fatal error: rom/miniz.h: No such file or directory
31 | #include <rom/miniz.h>Change in pngle.c into include <miniz.h> maybe?
Regards -
Core2 and M5Unified display no longer worksposted in Core 2
Wow,
I have uploaded the standard M5Unified Button code to my M5Core2.
I know the program is running because my serial.print shows button counts.
But the display shows nothing.
I have tried this on multiple Core2 of which I know the display is not defect. All boards and libs are updated (as fwr as i know).
What am i doing wrong here?
Thanks#include <M5Unified.h> void setup(void) { M5.begin(); Serial.begin(115200); /// For models with EPD : refresh control M5.Display.setEpdMode(epd_mode_t::epd_fastest); // fastest but very-low quality. if (M5.Display.width() < M5.Display.height()) { /// Landscape mode. M5.Display.setRotation(M5.Display.getRotation() ^ 1); } } void loop(void) { M5.delay(1); M5.update(); //------------------- Button test /* /// List of available buttons: M5Stack BASIC/GRAY/GO/FIRE: BtnA,BtnB,BtnC M5Stack Core2: BtnA,BtnB,BtnC,BtnPWR M5Stick C/CPlus: BtnA,BtnB, BtnPWR M5Stick CoreInk: BtnA,BtnB,BtnC,BtnPWR,BtnEXT M5Paper: BtnA,BtnB,BtnC M5Station: BtnA,BtnB,BtnC,BtnPWR M5Tough: BtnPWR M5Atom M5AtomU: BtnA M5Stamp Pico/C3/C3U: BtnA */ static constexpr const int colors[] = { TFT_WHITE, TFT_CYAN, TFT_RED, TFT_YELLOW, TFT_BLUE, TFT_GREEN }; static constexpr const char* const names[] = { "none", "wasHold", "wasClicked", "wasPressed", "wasReleased", "wasDeciedCount" }; int w = M5.Display.width() / 5; int h = M5.Display.height(); M5.Display.startWrite(); /// BtnPWR: "wasClicked"/"wasHold" can be use. /// BtnPWR of CoreInk: "isPressed"/"wasPressed"/"isReleased"/"wasReleased"/"wasClicked"/"wasHold"/"isHolding" can be use. int state = M5.BtnPWR.wasHold() ? 1 : M5.BtnPWR.wasClicked() ? 2 : M5.BtnPWR.wasPressed() ? 3 : M5.BtnPWR.wasReleased() ? 4 : M5.BtnPWR.wasDecideClickCount() ? 5 : 0; if (state) { M5_LOGI("BtnPWR:%s count:%d", names[state], M5.BtnPWR.getClickCount()); M5.Display.fillRect(w*0, 0, w-1, h, colors[state]); } /// BtnA,BtnB,BtnC,BtnEXT: "isPressed"/"wasPressed"/"isReleased"/"wasReleased"/"wasClicked"/"wasHold"/"isHolding" can be use. state = M5.BtnA.wasHold() ? 1 : M5.BtnA.wasClicked() ? 2 : M5.BtnA.wasPressed() ? 3 : M5.BtnA.wasReleased() ? 4 : M5.BtnA.wasDecideClickCount() ? 5 : 0; if (state) { M5_LOGI("BtnA:%s count:%d", names[state], M5.BtnA.getClickCount()); M5.Display.fillRect(w*1, 0, w-1, h, colors[state]); Serial.println(M5.BtnA.getClickCount()); } state = M5.BtnB.wasHold() ? 1 : M5.BtnB.wasClicked() ? 2 : M5.BtnB.wasPressed() ? 3 : M5.BtnB.wasReleased() ? 4 : M5.BtnB.wasDecideClickCount() ? 5 : 0; if (state) { M5_LOGI("BtnB:%s count:%d", names[state], M5.BtnB.getClickCount()); M5.Display.fillRect(w*2, 0, w-1, h, colors[state]); } state = M5.BtnC.wasHold() ? 1 : M5.BtnC.wasClicked() ? 2 : M5.BtnC.wasPressed() ? 3 : M5.BtnC.wasReleased() ? 4 : M5.BtnC.wasDecideClickCount() ? 5 : 0; if (state) { M5_LOGI("BtnC:%s count:%d", names[state], M5.BtnC.getClickCount()); M5.Display.fillRect(w*3, 0, w-1, h, colors[state]); } state = M5.BtnEXT.wasHold() ? 1 : M5.BtnEXT.wasClicked() ? 2 : M5.BtnEXT.wasPressed() ? 3 : M5.BtnEXT.wasReleased() ? 4 : M5.BtnEXT.wasDecideClickCount() ? 5 : 0; if (state) { M5_LOGI("BtnEXT:%s count:%d", names[state], M5.BtnEXT.getClickCount()); M5.Display.fillRect(w*4, 0, w-1, h, colors[state]); } M5.Display.endWrite(); } #if !defined ( ARDUINO ) && defined ( ESP_PLATFORM ) extern "C" { void loopTask(void*) { setup(); for (;;) { loop(); } vTaskDelete(NULL); } void app_main() { xTaskCreatePinnedToCore(loopTask, "loopTask", 8192, NULL, 1, NULL, 1); } } #endif -
8-Channel Servo Driver Unit to drive a 5 volt DC motorposted in Modules
Hi,
I was wondering, can i use the 8-Channel Servo Driver Unit (STM32F030) to directly PWM control a 5 volt DC motor?
Any thoughts ?Thanks
HappyUser -
LoRa Unit with Antenna (E220) how to wake up?posted in Units
Description explains me :
It utilizes convenient serial communication. It supports point-to-point transmission and broadcast modes, as well as wireless wake-up,I am curious how that can be done, certainly because pin AUX is not connected.
The documentation for the chip ( E220-400T22S) reads like this :
pin 24
AUX
Output
Used to indicate the working status of the module;
The user wakes up the external MCU and outputs low level during power-on self-check initialization; (can be left floating) -
AtomS33R Camera, control blue light on the frontposted in Atom
Sorry, no doubt i have missed it in the documentation and sample, but how can I control the blue led on the front of the camera?
Or is this the IR Led driven by GPIO_Num_47?
Oh, now I see, it is the blue led connected to 3 Volt.
Thank you.
This code does not seem to work :#include <M5AtomS3.h> void setup() { AtomS3.begin(true); // Init M5AtomS3Lite. AtomS3.dis.setBrightness(10); } void loop() { AtomS3.dis.drawpix(0xff0000); AtomS3.update(); delay(500); AtomS3.dis.drawpix(0x00ff00); AtomS3.update(); delay(500); AtomS3.dis.drawpix(0x0000ff); AtomS3.update(); delay(500); } -
RE: M5 paper reading google sheetposted in General
@paulpattyn Uh, how about use Google : https://www.instructables.com/Post-to-Google-Docs-with-Arduino/
Regards -
RE: Unit cam S3 : .ino files , where to findposted in Units
@kuriko Thank you. I would have hoped that they also supply Arduino code.
-
Unit cam S3 : .ino files , where to findposted in Units
Hi there,
I was wondering, where can I find software, for example the firmware, that I can open directly in the Arduino development software. I have found the GitHub page but I don’t see any .ino files.
Thanks. -
RE: RFID 2 unit and I2C hub 1 to 6 expansion unitposted in Units
@laursena please check the version of ClosedCube.cpp and ClosedCube.h you are using. The one that is provided by M5stack is the newest.
(* In the examples of M5StickCPlus in the directory Unit/PaHub you may find these documents. *) -
RE: RFID 2 unit and I2C hub 1 to 6 expansion unitposted in Units
SOLVED : After remeniscing abount my life, and specifically what goes wrong here, i just realised : could it be that I am using an outdated library of ClosedCube. And yes, after using the version from 4 April 2023, everything works fine now.
@felmue In Dutch : Krijg nou wat?
I put the RFID 2 module in slot 1 of the TCA 9548A module and then in channel 0 (weird because i have placed it in channel 1) i see address 0x28 of the RFID popping up.Does this mean that channel 0 on the module is not usable?
ThanksIn follow_up , I have checked ClosedCube_TCA9548A.cpp and the selctChannel goes like this :
uint8_t ClosedCube::Wired::TCA9548A::selectChannel(uint8_t channel) { uint8_t result = 0xff; if (channel < TCA9548A_MAX_CHANNELS) { Wire.beginTransmission(_address); Wire.write(((uint8_t)1) << (channel)); _currentChannel = channel; result = Wire.endTransmission(); } return result; }That seems to be correct if I read the documentation of the Texas Instrument module TCA9548A
I am really misunderstaning something or could it be that their is somekind of wire mixup in the module?
Btw, I also dont see a reset channel somewhere in the code.
Now i did another experiment using PCA9548AP (the newer version).
Plugging in the RFID in channel 0 gives no response.
Plugging in channel 1 : software tels me the device is in channel 0
Plugging in a second RFID in channel 2 :software tells met a I have another device in channel 1.I tried to increase the max number of channels to 8 (assuming that channel 0 is somehow connected to channel 7 of 8). Still no response when i attach a device physically on channel 0.
This is really weird behaviour. I hope someone is at least able to reproduce this behaviour.