AIS4 transplan my AIS coding from arduino to ESP32

ESP32 is a cheap chip with lot of varities of boards, and good support with community.
The integration is very high:
2 MCU + wifi+BLE on chip, and you can easily find boards with OLED, Lora, beside the serial0 used by bootloader, there are still serial1 and 2 for other connections.
The integrated touch sensor could be used for water prove buttons.

So, I decided to put this program on ESP32 for easier development.

The first trouble I came across is the uart pin selection.
ESP32 has a pin muxing matrix function, so you can almost use any pin you want for your selected function. But there are some pins we should avoid:
Internal connection to flash.
pin related to bootloader.

So, I end up with connecting my GPS on serial1 pin4 as Rx, few modification on serial stuff, code works great...I love arduino!!

https://github.com/Ldsrc2008/AIS-encode-arduino/tree/master/GPS_ESP32_Uart104_make_AIS_sentence

Now I wish to add OLED display for :
  1. GPS status: 3D fix (or locationavailable?), sat Nr, Hdop
  2. GPS Lat, Lon
  3. GPS COG, SOG
  4. and maybe later heading, heeling angle
which may need to be seperated into few pages, I wish to do this with ESP32 touch sensor.
Again, I need to check the pins
There are several lib for 1306 OLED I have installed the following 2, they are all included in arduino IDE that I used V1.8.5:
  1. Driver for the SSD1306 and SH1106 based 128x64 pixel OLED display running on the Arduino/ESP8266 platform https://blog.squix.org/
  2. the Adafruit SSD1306 library repository on GitHub
the first one works out of box, I remember I used the 2nd one on  a 1280*64OLED on arduino, and it's noted that the reset pin need to re-assigned with ESP, I don't know where is the reset pin of the board. So, this time I will stick on the first one.

With squix's blog has also some thing interest me a lot...

But...this wemos esp32 OLED board I2C pins are on GPIO 5 and 4 for data and clock respectively.So, I need to move my GPS pin...

So, In short  GPIO0,1,2,3 are not usable, GPIO12 either(unless you will unplug the thing that you connected during boot up or loading code)

it should be straight forward with the library. then next concern is to see how to make the the page control and size of font and OLED.

I got problem if I wish to add touch sensor....after looking in to all the stuff I have, I need to move again:
Rx1=IO13
TX1=IO16
Rx2=IO25
TX2=IO26
then I could leave me
touch6=IO14
touch3=IO15

The code could work without issue on boot nor download

留言

這個網誌中的熱門文章

Heltec ESP32+OLED+Lora, hardware testing

micro SD card for ESP32, on lolin32 with OLED and heltec 32 lora oled

AIS0. understanding AIS NMEA 0183: How it's coded