Anything not specifically related to the Speeduino hardware. Eg sensors, bluetooth, displays etc
User avatar
By BearWolf
#68616
So, I've been trying HC-06, four modules of them from different outlets, but never got them to work so I gave up.
I have since found Seeed Xiao ESP32C3 which has a small form factor and can be pinned or SMD mounted. Well, my issue is I know nothing about code, but so far I have been able to put my module in both AP and BLE and connect to it (I have not tried to run it over WiFi where it connects to a router). However, what I have failed to do is to communicate with my Mega 2560. I have it wired up properly as far as I can tell with a logic level shifter. I have set IP to 192.168.4.1 and port 80 in TS but it fails when testing the connection. Where is the issue with my code, if there is any, as I presume that's where I err?
I am sure someone else has a way better understanding of how to do this.
TIA
Code: Select all
#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiAP.h>
#include <HardwareSerial.h>

const char* ssid = "Test";     // WiFi Access Point SSID
const char* password = "12345678"; // WiFi Access Point password
WiFiServer server(80);             // TCP server on port 80

void setup() {
  Serial.begin(115200);   // Initialize Serial for debugging
  Serial1.begin(9600);    // Initialize UART for communication with Arduino Mega 2560
  
  // Start WiFi Access Point
  WiFi.softAP(ssid, password);
  IPAddress IP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(IP);

  server.begin();         // Start TCP server
}

void loop() {
  WiFiClient client = server.available();

  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char data = client.read();
        Serial1.write(data);   // Forward received data to Arduino Mega 2560 over UART
      }
      if (Serial1.available()) {
        char data = Serial1.read();
        client.write(data);    // Forward data received from Arduino Mega 2560 to WiFi client
      }
    }
    client.stop();   // Close client connection
  }
}
User avatar
By PSIG
#68620
Haven't tried that myself, but as I have used a zillion HC-06 modules, I'm curious what failed? I assume you followed the Wiki Bluetooth page, including reprogramming the module?

I am not trying to fix your Bluetooth issue, but if the instructions need new info, then I would like to confirm that. ;)
User avatar
By BearWolf
#68624
TBH it's been a while, but as I recall it, none communicated with my Mega. I set them up according how to reprogram them (btw the link https://wiki.speeduino.com/en/Bluetooth ... oth_Module is a dead end how to do that nowadays) and they connected well, but nada. RX to TX and TX to RX as described as well, so either all my units were wrong or my Mega is wrong. From searching info about the HC-05/06 it seems there's a lot of other people with similar issues, so that's why I wanted to try something else as I can get the ESP32C3 from a genuine source such as Mouser.
User avatar
By BearWolf
#68625
Look how cute that little fella is. Now I just need it to talk to my Mega....
Attachments
ESP32C3.jpg
ESP32C3.jpg (59.99 KiB) Viewed 318 times
User avatar
By PSIG
#68628
The correct links to BT/wireless info are in my last post. Once you program with correct values and figure-out how to connect with HC, the ESP should also work fine, or vice-versa. When you find the issue, please post it for review and instructions improvement. Good luck! 8-)
User avatar
By BearWolf
#68629
A little update.
I checked the serial monitor and see the Speeduino showed up there when I made a "test port' in TS, which says it failed. Hmmmmm

Hi PSIG. I really appreciate the help. I have no[…]

Of course, I will likely seize a cylinder and inc[…]

speeduino injector

What is the maximun resistance for nozzles is 14[…]

Hi all, i'm from Brasil, here is very dificult t[…]

Still can't find what you're looking for?