Extending ESP32 Functionality by Using Raspberry Pi HATs
The ESP32 processor, integrating peripherals such as UART, CAN Bus, WIFI, and Bluetooth, allows a wide range of applications, and the low price adds to its popularity.
There are various ESP32 development boards available in the market, such as the ESP32-WROOM-32, as shown to the left. However, compared to popular systems like the Raspberry Pi or Arduino, the hardware resources, i.e., additional peripherals, are limited.
Consequently, the thought of tapping into the vast resources of the Raspberry Pi or Arduino system makes sense. In this post, I am using several of our Raspberry Pi CAN boards and accessing them per one of our ESP32 modules. This post's method also applies to any other ESP32 module that provides external SPI and UART signals.
Note: For more detailed information on the ESP32 SPI interface, please refer to another post, ESP32 Triple CAN Bus Application Through Adding Two MCP2515 Ports.
Connecting Arduino Shields to ESP32
This part is for those curious enough to ask why I didn't use the vast Arduino hardware resources (shields): As I mentioned in the above referenced post, the ESP32 uses a 3.3 VDC SPI signal level, which will not work with the 5 VDC signal level as used on Arduino shields. For the same reason, most Arduino shields will not work with the Arduino Due, which also uses 3.3 VDC.
Connecting Raspberry Pi PICAN HATs to ESP32
Please be aware that each ESP32 module might have different assignments for the SPI signals, i.e., MOSI, MISO, SCLK, and CS. Even the nomenclature of these signals may differ. But, as demonstrated below, the wiring is fairly straight-forward. The below diagram shows the necessary SPI signals on an ESP32-WROOM-32 development board as well as the RPi's 40-pin GPIO header:
The wiring is fairly easy:
ESP32 ----> RPi HAT
SCK ----> SCK SPI Data Output
MISO ----> MISO SPI Clock Input
MOSI ----> MOSI SPI Data Input
CS/SS ----> CS Chip Select
Again, refer to above referenced post for more information.
PICAN CAN Bus HAT For Raspberry Pi
The PICAN series of boards provides Controller Area Network (CAN) Bus capabilities for the Raspberry Pi. It comes with an easy-to-install SocketCAN driver, programming can be accomplished in C or Python, and we provide many programming samples and further references.
The PICAN series supports many hardware variants, including single- or dual channel ports, isolated or non-isolated, Classical CAN or CAN FD, NMEA 2000, plus additional features such as GPS, Gyro, Accelerometer, and Real-Time Clock (RTC).
All of the boards supporting Classical CAN use the MCP2515 CAN Bus controller, and so I was able to access all boards using the same software, and that includes the PICAN DUO boards. The software allows the use of multiple instances to access more than one SPI port. However, the RPi's GPIO header provides only two CS (Chip Select) signals, thus limiting the number of SPI ports to two.
The image on top of the page shows a setup with the PICAN-M - NMEA 0183 and NMEA 2000 HAT for Raspberry Pi. The NMEA 2000 port is controlled by the MCP2515, while the NME 0183 port is connected to the RPi's UART0_TX, and UART0_RX signals.
Electronics Projects with the ESP8266 and ESP32: Building Web Pages, Applications, and WiFi Enabled Devices
Copperhill Technologies highly recommends using this book for your wireless application projects. Yes, many good books and free online resources are available these days, but this is the book we are using. It made our approach to Bluetooth, BLE, and WIFI a breeze. Programming wireless applications without hassles was fun, and we will share them on this web page.
Projects throughout the book utilize the wireless functionality and processing power of the ESP microcontrollers. Projects are built in the Arduino IDE, so you don't need to download other programming software. In addition, mobile apps are now ubiquitous, making the app build projects of the book very relevant, as are the web page design projects.
In Electronics Projects with the ESP8266 and ESP32, you'll see how easy and practical it is to access information over the internet, develop web pages, build mobile apps to remotely control devices with speech recognition, or incorporate Google Maps in a GPS route tracking app. More Information...
Raspberry Pi Compute Module With CAN FD for Automation and IoT Applications
Kontron announced the release of their Pi-Tron CM4 computer with Linux OS, which utilizes the fourth-generation Raspberry Pi compute module with the 1,5-GHz, 64-bit Broadcom BCM2711 chip and four Arm Cortex-A72 processors. The computer’s steel housing allows for universal use, e.g., for automation and IoT (Internet of Things) applications. Depending on the variant, it provides a 1-GiB, 2-GB, [...]
Multifunctional Education and Development Ecosystem Powered by the Raspberry Pi Pico
Pico Bricks is a multifunctional education and development ecosystem powered by the Raspberry Pi Pico board. Its modular design effectively supports a fool-proof learning environment. Moreover, it has complete flexibility for using nearly all components worldwide. To summarize, it is a Raspberry Pi Pico add-on system for much more reliable and more accessible use.The kit [...]
Fast-Boot Your Raspberry Pi 3 Linux In Under Two seconds
Raspberry Pi enthusiasts are looking for a way to fast boot a Raspberry Pi mini PC. They may be interested in a new project available via Github. The project describes the fast booting of a Raspberry Pi 32 Linux in under two seconds. Check out the video link below to demonstrate how quickly you [...]
Testing NMEA 0183 For The PICAN-M - NMEA 0183 & NMEA 2000 HAT For Raspberry Pi
PICAN-M - NMEA 0183 & NMEA 2000 HAT For Raspberry Pi Our PICAN-M (M = Marine) is a Raspberry Pi HAT with NMEA 0183 and NMEA 2000 connection. The NMEA 0183 (RS422) port is accessible via a 5-way screw terminal. The NMEA 2000 port is accessible via a Micro-C connector. The board comes with a 3A SMPS (Switch [...]
Advanced IoT Programming Using The Raspberry Pi 4 And Python 3
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built-in data structures, combined with dynamic typing and dynamic binding, made it very attractive for Rapid Application Development. It is used as a scripting or glue language to connect existing components. Python's simple, easy-to-learn syntax emphasizes readability and therefore reduces the cost of [...]
4G Telematics Unit With OBD-II (CAN Bus) Port For Fleet Management
The TMU Pi3 telematics unit by Autopi (Denmark) utilizes the Raspberry Pi 3 Model A+ SBC, and it connects to in-vehicle CAN Bus networks via the OBD2 port.The device uses the 1,4-GHz Broadcom BCM2837B0 SOC with Cortex-A53 64-bit quad-core processor, including 512-MiB SDRAM and a 32-GiB micro SD card with installed Raspbian Jessie operating system and Autopi [...]
Programmable Maritime Application System Based on Raspberry Pi Supports NMEA 2000 Functionality
NMEA 2000 is a marine networking standard created and administered by the National Marine Electronics Association (NMEA). The NMEA is an association of marine electronics manufacturers, dealers, and technicians. The NMEA 2000 standard describes a low-cost, moderate capacity, bi-directional, multi-transmitter, multi-receiver instrument network. Typical data on a network using this standard include: Position latitude and longitude. GPS status. Steering [...]
Installing python-can on the Raspberry Pi
This post demonstrates the steps required to install python-can on the Raspberry Pi for use with PiCAN2, PiCAN3, PiCAN-M CAN Bus HATs. First make sure the driver is installed. See:PiCAN2, PiCAN3, and PiCAN-M Driver Installation for Raspberry Pi...Now install python-can: pip3 install python-can Check there is no error. You can now initialize the CAN interface: sudo /sbin/ip link set can0 [...]
PiCAN2, PiCAN3, and PiCAN-M Driver Installation for Raspberry Pi
This post provides you a brief overview on the steps required to install the software driver on the Raspberry Pi for use with the PiCAN2, PiCAN3, and PiCAN-M CAN Bus HATs, including the dual-port and SMPS versions. Please refer also to the board's user manual. Start by creating a new SD card image with the Raspberry Pi [...]