Use ESP32 Web interface also as GVRET CAN device?

Discussion about various user interfaces such as web interface, displays and apps
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

RetroZero wrote: Sun Apr 14, 2024 6:48 am @Jacobmess, thankyou for this info!! This was my problem. The Wifican password is "topsecret" and not my home network password.
So once the "credentials.h file has been modified with local your wifi details", load the sketch and connect to the new "wifican network" using "topsecret" as the password. (I assume we can change this directly in the wifi.ino if we want to)
It might seem so simple, that it not need saying. Many days of rebooting later, I have a wifican up and running. I'll add this to the wiki alongside @gregski's CanDue.
Many thanks again....Happy Can sniffing!
Yes, the wifi approch needs better documentation. Would be really great to have it on the wiki.
I try to explain with my words here:
The wifican supports two different modes of wifi operation. The mode is selected by the level of pin35 during startup.
(1) The "home mode". In the source code called WIFI_MODE_STATION. This mode is reached when during the boot the pin35 is high (3.3V). The wifican tries to connect to your home wifi. You configured the name of your wifi and the password in wifi_credentials.h. The wifican will be in your home network, so you can use SavvyCAN to observe the CAN while you are in parallel browsing the internet or sending mails.
(2) The "field mode". In the source code called WIFI_MODE_ACCESS_POINT. This mode is reached if during boot the pin35 is grounded. The wifican will create its own wifi network, called "wifican" and with the password "topsecret", configurable here: https://github.com/uhi22/wifican/blob/3 ... an.ino#L15. To use this mode, go to the wifi settings of your laptop, and connect to the "wifican". This means, you will loose your internet connection, because you change your wifi connection from your router to the wifican. This mode is intended to use when you are outside, where you do not reach your home wifi network anyway.
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Once I've got mine up and running and that I understand, I'll do a wiki update.
I'll try the debug setup first that seems to loop. Then get some info from a can bus. I have an instrument cluster I'm playing with, but I think it needs a wake up message first, so will try to connect to working bus firstly.
I'm glad the setup works with Savvycan!
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

For debugging your setup, you could add the data base file (dbc) of the "virtual" debug messages into SavvyCAN. This file is here: https://github.com/uhi22/wifican/blob/m ... opment.dbc
This allows you to see how long the wifican is running (wificanAliveCounter is counting up), and how many messages it has seen on CAN (wificanTotalRxMessages)
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Ok, thanks for that. I'll do that. It's perfect as I'm trying to find reliable dbc files....
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

For info, I only can get it working with Pin35 to GND. Tried Pin35 to Pin 47, Tried Pin35 to 3.3v.
So for now, only remote access is possible. Wifican is not detectable when Pin 35 pulled HIGH..
My wifi network and password have to be Inside of the "wifi_SSID" and "wifi_password" emplacements that you have provided? Just making double sure I'm not screwing this up all by myself. Maybe I have a dodgy board?
Jacobsmess
Posts: 496
Joined: Thu Mar 02, 2023 1:30 pm
Location: Uk
Has thanked: 254 times
Been thanked: 66 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by Jacobsmess »

RetroZero wrote: Mon Apr 15, 2024 7:47 pm For info, I only can get it working with Pin35 to GND. Tried Pin35 to Pin 47, Tried Pin35 to 3.3v.
So for now, only remote access is possible. Wifican is not detectable when Pin 35 pulled HIGH..
My wifi network and password have to be Inside of the "wifi_SSID" and "wifi_password" emplacements that you have provided? Just making double sure I'm not screwing this up all by myself. Maybe I have a dodgy board?
I've only ever run mine remotely never via my own WiFi as my connection isn't great where my workshop is but yes you need to enter your WiFi SSID and password into the WiFi credentials file where Uhi specifies.
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

That's what I did. No wifican. Wanted to get this all sorted out to add to the wiki.
I'm away a few days so remote mode will have to until the weekend.
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

RetroZero wrote: Mon Apr 15, 2024 7:47 pm Wifican is not detectable when Pin 35 pulled HIGH..
You can check the following. While still connected with the cable to the arduino IDE, open the serial monitor in the Arduino IDE. Press the reset button on the board. You should see some logging in the serial monitor.

Code: Select all

wifiMode1
....
WifiMode is 'station'. Connecting to PlischUndPlum
....
[  1903][V][WiFiGeneric.cpp:355] _arduino_event_cb(): STA Connected: SSID: PlischUndPlum, BSSID: dc:15:c8:0a:66:3c, Channel: 11, Auth: WPA2_PSK
[  1905][D][WiFiGeneric.cpp:1039] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
STA Connected[  1912][V][WiFiGeneric.cpp:369] _arduino_event_cb(): STA Got New IP:192.168.2.123
[  1923][D][WiFiGeneric.cpp:1039] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[  1928][D][WiFiGeneric.cpp:1102] _eventCallback(): STA IP: 192.168.2.123, MASK: 255.255.255.0, GW: 192.168.2.1
STA IPv4: 192.168.2.123
WiFi connected
IP address: 
192.168.2.123
telnet is listening
This log shows whether the connection to your home network was successful. What do you mean that "wifican is not detectable"? You could check in the web interface of your router, whether you see the device. In my case, I have a FritzBox router, it looks like this:
image.png
image.png (3.84 KiB) Viewed 956 times
It is normal, that you do not see the wifican in the wifi list of your laptop. Because it does not create a own network, it uses your existing home network.
When the SavvyCAN and the wifican is in the same network, the SavvyCAN auto-detects the IP in the connection window:
image.png
image.png (6.98 KiB) Viewed 956 times
RetroZero wrote: Mon Apr 15, 2024 7:47 pm Maybe I have a dodgy board?
This is unlikely. If the board works as wifi access point, it will also work as wifi station.
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I'm back at home. I must be missing something.
I can get SavvyCan to connect only when in "field mode".
It means I can't have internet at the same time.
In Serial Monitor, there are simple "blank squares" and then "x" between them. If I press the "reset button" , the "sqares" and "x" keep running on.
Since I am not sure of my connection, I am not sure to be capturing CAN data

Edit : For info, I can "capture CAN" messages in "field mode". My objective is to send messages to different light signals and instrument cluster RPM on this cluster. This experiment is preparing me for installing and working with a VW 3.6kw charger......
Attachments
SavvyCan_logs.csv
(423.09 KiB) Downloaded 9 times
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

Sounds like wrong baud rate of the serial monitor. 115200 is used in the Serial.begin.
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

That would be to check messages in 'serial monitor' right?
I'll try to check pathway for wifi_credential.h to make sure it's taking the correct password etc.
There's no firewall settings or something that could block this type of connection?
When I browse wifi networks around me,connected or not, there's no wifican when pin 37 is pulled high (pin 47).
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

This is normal. With pin 37 high, the device is a "Station", it does not publish an own wifi network. It will try to connect your home network, so it does not appear in a wifi list. The only relevant thing is that you provided the right name and password in the credentials file.
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

It looks like the correct details are in the credentials file, but Savvycan doesn't find it, or connect when I manually put in ip address. I'll change the baud rate in arduino and see what info I can retrieve to compare what you posted. Thanks for the replies, this is a great tool I think . Can't wait to be able to send a few can commands and see that I managed the baby step in 'reverse engineering '
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Thanks again, but after several attempts , I get a "STA STARTED" and then repeatedly "STA DISCONNECTED" when Resetting my ESP32.
I've errased and refreshed the sketch a few times now. I even reset my Wifi and WPS button. I wonder if I have some kind of setting blocking the connection , like a pop up blocker or something. I'll keep at it.
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

No. A blocker on the PC would not prevent the esp from connecting your router. Are you sure your router provides a 2.4GHz wifi, not only 5GHz? Is the router near? Are you sure the wifi name and password is the same as the router expects?
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I have 2 wifi names, I removed the _5GHZ from the file, and it has connected to the 2.4GHZ network. I can also connect it via SavvyCan!!!!
Huge thanks, and time for me to do some Wiki writing. Thanks again @Uhi222 !
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Please check that I have correctly documented your great solution in the Wiki 8-)
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

Many thanks for updating the wiki. I also now updated the wifican documentation, and added links to the wiki and to this thread.
https://github.com/uhi22/wifican?tab=re ... tart-guide
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

Happy can fuzzing and dbc searching 😉
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

Just noticed, that the transmit path of WifiCAN has a problem. The transmit messages, which I configure in SavvyCAN are not physically on the bus. Investigation is ongoing.
https://github.com/uhi22/wifican/issues/1
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I found some info on can id that I'll try to configure and send to my bench setup to instrument cluster. Will confirm if it works. Trying to see if I can use my vcds to extract can related data at the same time.
User avatar
uhi22
Posts: 609
Joined: Mon Mar 14, 2022 3:20 pm
Location: Ingolstadt/Germany
Has thanked: 92 times
Been thanked: 415 times

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by uhi22 »

Using the bus number 3 the transmitting works. This number is also shown in the main window. Not sure why it is number 3, but at least it works.
image.png
image.png (4.39 KiB) Viewed 82 times
RetroZero
Posts: 735
Joined: Tue Oct 29, 2019 2:48 pm
Location: France
Has thanked: 338 times
Been thanked: 44 times
Contact:

Re: Use ESP32 Web interface also as GVRET CAN device?

Post by RetroZero »

I can confirm transmitting works on Bus 3 !!!! Huge thanks @uhi22 !!!
I started with some Fuzzing and found my ID for RPM - 0x280. I'll play around now to see how to select and hone in on bit values.
Baby steps
Post Reply