Projects with Arduino Uno & Raspberry Pi with Examples for the MCP2515 CAN Bus Interface Module
This book details the use of the Arduino Uno and the Raspberry Pi 4 in practical CAN bus based projects. Using either the Arduino Uno or the Raspberry Pi with off-the-shelf CAN bus interface modules considerably ease developing, debugging, and testing CAN bus based projects.
This book is written for students, practicing engineers, enthusiasts, and for everyone else wanting to learn more about the CAN bus and its applications. The book assumes that the reader has some knowledge of basic electronics. Knowledge of the C and Python programming languages and programming the Arduino Uno using its IDE and Raspberry Pi will be useful, especially if the reader intends to develop microcontroller-based projects using the CAN bus.
The book should be a useful source of reference material for anyone interested in finding answers to questions such as:
What bus systems are available for the automotive industry?
What are the principles of the CAN bus?
How can I create a physical CAN bus?
What types of frames (or data packets) are available in a CAN bus system?
How can errors be detected in a CAN bus system and how dependable is a CAN bus system?
What types of CAN bus controllers exist?
How do I use the MCP2515 CAN bus controller?
How do I create 2-node Arduino Uno-based CAN bus projects?
How do I create 3-node Arduino Uno-based CAN bus projects?
How do I set the acceptance masks and acceptance filters?
How do I analyze data on the CAN bus?
How do I create 2-node Raspberry Pi-based CAN bus projects?
How do I create 3-node Raspberry Pi-based CAN bus projects?
Zeitsteuerung, Scheduler, PIO und Zustandsmaschinen
Multitasking ist der Schlüssel zu leistungsfähigen Embedded-Systemen, und zugleich eine der größten Herausforderungen in der Mikrocontroller-Programmierung. Dieses Buch zeigt Ihnen Schritt für Schritt, wie Sie von einem einfachen Ein-Task-Programm zu einem strukturierten, reaktionsfähigen und skalierbaren System gelangen. Dabei steht nicht nur das Wie, sondern vor allem das Warum im Mittelpunkt.
Sie lernen:
warum scheinbare Parallelität entsteht
weshalb blockierende Programme instabil werden
wie Aufgaben effizient und kontrolliert parallel ablaufen
Ausgehend vom klassischen Superloop vermittelt das Buch moderne Multitasking-Strategien – von nicht-blockierender Programmierung und Tick-Systemen bis zu Task-Schedulern, Zustandsmaschinen und ereignisgesteuerten Konzepten.
Der Fokus liegt auf der Praxis: Sensoren, Displays, Kommunikation und reale Anwendungen werden Schritt für Schritt integriert und mit verständlich kommentierten Beispielprogrammen erklärt.
Fortgeschrittene Themen umfassen:
Multicore-Programmierung mit dem Raspberry Pi Pico
asynchrones Programmieren mit uasyncio
RTOS-Grundlagen mit FreeRTOS
die Kombination aus Multicore und RTOS
Dabei werden auch die Grenzen dieser Techniken, insbesondere unter MicroPython, klar aufgezeigt.
Das Buch richtet sich an ambitionierte Einsteiger und fortgeschrittene Entwickler, die Embedded-Systeme fundiert verstehen und robuste, wartbare Multitasking-Anwendungen entwickeln möchten.
Program, build, and master 60+ projects with the Wireless RP2040
The Raspberry Pi Pico and Pico W are based on the fast, efficient, and low-cost dual-core ARM Cortex M0+ RP2040 microcontroller chip running at up to 133 MHz and sporting 264 KB of SRAM and 2 MB of Flash memory. Besides spacious memory, the Pico and Pico W offer many GPIO pins, and popular peripheral interface modules like ADC, SPI, I²C, UART, PWM, timing modules, a hardware debug interface, and an internal temperature sensor.
The Raspberry Pi Pico W additionally includes an on-board Infineon CYW43439 Bluetooth and Wi-Fi chipset. At the time of writing this book, the Bluetooth firmware was not yet available. Wi-Fi is however fully supported at 2.4 GHz using the 802.11b/g/n protocols.
This book is an introduction to using the Raspberry Pi Pico W in conjunction with the MicroPython programming language. The Thonny development environment (IDE) is used in all of the 60+ working and tested projects covering the following topics:
Installing the MicroPython on Raspberry Pi Pico using a Raspberry Pi or a PC
Timer interrupts and external interrupts
Analogue-to-digital converter (ADC) projects
Using the internal temperature sensor and external sensor chips
Using the internal temperature sensor and external temperature sensor chips
Datalogging projects
PWM, UART, I²C, and SPI projects
Using Bluetooth, WiFi, and apps to communicate with smartphones
Digital-to-analogue converter (DAC) projects
All projects are tried & tested. They can be implemented on both the Raspberry Pi Pico and Raspberry Pi Pico W, although the Wi-Fi-based subjects will run on the Pico W only. Basic programming and electronics experience are required to follow the projects. Brief descriptions, block diagrams, detailed circuit diagrams, and full MicroPython program listings are given for all projects.
PC USB Logic Analyzers with Arduino, Raspberry Pi, and Co.
Step-by-step instructions guide you through the analysis of modern protocols such as I²C, SPI, UART, RS-232, NeoPixel, WS28xx, HD44780 and 1-Wire. With the help of numerous experimental circuits based on the Raspberry Pi Pico, Arduino Uno and the Bus Pirate, you will learn the practical application of popular USB logic analyzers.
All the experimental circuits presented in this book have been fully tested and are fully functional. The necessary program listings are included – no special programming or electronics knowledge is required for these circuits. The programming languages used are MicroPython and C along with the development environments Thonny and Arduino IDE.
This book uses several models of flexible and widely available USB logic analyzers and shows the strengths and weaknesses of each price range.
You will learn about the criteria that matter for your work and be able to find the right device for you.
Whether Arduino, Raspberry Pi or Raspberry Pi Pico, the example circuits shown allow you to get started quickly with protocol analysis and can also serve as a basis for your own experiments.
After reading this book, you will be familiar with all the important terms and contexts, conduct your own experiments, analyze protocols independently, culminating in a comprehensive knowledge set of digital signals and protocols.
Mehr als 50 Grundlagenprojekte mit MicroPython und dem RP2040-Mikrocontroller
Der Raspberry Pi Pico ist eine leistungsstarke Mikrocontroller-Platine, die speziell für das Physical Computing – also hardwarenahe Anwendungen – entwickelt wurde. Der Raspberry Pi Pico kann so programmiert werden, dass er eine einzelne Aufgabe sehr effizient ausführt und ermöglicht so schnelle Steuerungs- und Überwachungsanwendungen in Echtzeit. Der 'Pico', wie wir ihn nennen, basiert auf dem schnellen, effizienten und kostengünstigen Dual-Core ARM Cortex-M0+ RP2040 Mikrocontroller-Chip, der mit bis zu 133 MHz läuft und über 264 KB SRAM und 2 MB Flash-Speicher verfügt. Neben dem großen Speicher hat der Pico noch weitere attraktive Eigenschaften, darunter eine große Anzahl von GPIO-Pins sowie gängige Schnittstellen wie ADC, SPI, I²C, UART und PWM. Als Krönung bietet der Chip schnelle und genaue Timer, eine Hardware-Debug-Schnittstelle und einen internen Temperatursensor.
Zur Programmierung lassen sich leicht die gängigen Hochsprachen wie MicroPython oder C/C++ verwenden. Dieses Buch ist eine Einführung in die Verwendung des Pico mit der Programmiersprache MicroPython. In allen Projekten wird die Thonny-Entwicklungsumgebung (IDE) eingesetzt. Über 50 Projekte decken folgende Themen ab:
Installation von MicroPython auf dem Raspberry Pi Pico
Timer-Interrupts und externe Interrupts
Projekte mit Analog-Digital-Wandler (ADC)
Verwendung des internen sowie externer Temperatursensoren
Datenlogger
Projekte zur PWM, UART, I²C-Bus und SPI-Bus
Wi-Fi und Bluetooth für die Kommunikation mit Smartphones
Projekte mit dem Digital-Analog-Wandler (DAC)
Alle in diesem Buch vorgestellten Projekte wurden vollständig getestet und sind funktionsfähig. Es werden keine Programmier- oder Elektronikkenntnisse vorausgesetzt, um sie nachzuvollziehen. Für alle beschriebenen Projekte gibt es kurze Beschreibungen, Blockdiagramme, detaillierte Schaltpläne und vollständige MicroPython-Programmlistings. Die Listings sind auch auf der zum Buch gehörenden Elektor-Webseite zu finden.
Program, build, and master over 50 projects with MicroPython and the RP2040 microprocessor The Raspberry Pi Pico is a high-performance microcontroller module designed especially for physical computing. Microcontrollers differ from single-board computers, like the Raspberry Pi 4, in not having an operating system. The Raspberry Pi Pico can be programmed to run a single task very efficiently within real-time control and monitoring applications requiring speed. The ‘Pico’ as we call it, is based on the fast, efficient, and low-cost dual-core ARM Cortex-M0+ RP2040 microcontroller chip running at up to 133 MHz and sporting 264 KB of SRAM, and 2 MB of Flash memory. Besides its large memory, the Pico has even more attractive features including a vast number of GPIO pins, and popular interface modules like ADC, SPI, I²C, UART, and PWM. To cap it all, the chip offers fast and accurate timing modules, a hardware debug interface, and an internal temperature sensor. The Raspberry Pi Pico is easily programmed using popular high-level languages such as MicroPython and or C/C++. This book is an introduction to using the Raspberry Pi Pico microcontroller in conjunction with the MicroPython programming language. The Thonny development environment (IDE) is used in all the projects described. There are over 50 working and tested projects in the book, covering the following topics: Installing the MicroPython on Raspberry Pi Pico using a Raspberry Pi or a PC Timer interrupts and external interrupts Analogue-to-digital converter (ADC) projects Using the internal temperature sensor and external temperature sensor chips Datalogging projects PWM, UART, I²C, and SPI projects Using Wi-Fi and apps to communicate with smartphones Using Bluetooth and apps to communicate with smartphones Digital-to-analogue converter (DAC) projects All projects given in the book have been fully tested and are working. Only basic programming and electronics experience is required to follow the projects. Brief descriptions, block diagrams, detailed circuit diagrams, and full MicroPython program listings are given for all projects described. Readers can find the program listings on the Elektor web page created to support the book.
Dit boek gaat over de Raspberry Pi, en over het programmeren in C. De programmeertaal C en het besturingssysteem Linux (Raspbian) passen uitstekend bij elkaar. Alles wat we nodig hebben om in C te programmeren wordt meegeleverd met het besturingssysteem van de Raspberry Pi.
In dit boek leert u hoe C gebruikt wordt met de Raspberry Pi, en krijgt u een overzicht van de taal.
WiringPi is een softwarebibliotheek voor de Raspberry Pi waarmee C hardware-uitbreidingen kan benaderen. Die bibliotheek wordt gebruikt om sensoren uit te lezen en om extra hardware aan te sturen. U gaat experimenteren met LED’s en schakelaars, met motoren, met geluid en met sensoren voor temperatuur, luchtdruk, en luchtvochtigheid.
Met een Linux-systeem kunt u een webserver maken, inclusief interactieve websites met PHP en WiringPi. Daarom is ook een beknopt overzicht van HTML en PHP in het boek opgenomen. In de voorbeelden worden sensoren via het web uitgelezen en worden apparaten bestuurd. In het laatste voorbeeld wordt een temperatuurlogger gemaakt. Die meet elk kwartier de temperatuur. Een tabel met de meetwaarden kan via het web worden uitgelezen.
Alle voorbeeldprogramma’s kunnen worden gedownload van de website van Elektor.
Praxisnahe Projekte, Profi-Tricks und eigene Anwendungen
Dieses Buch führt Sie Schritt für Schritt in die faszinierende Welt der State Machines ein und zeigt, wie Sie Hardware direkt und effizient ansteuern können – jenseits klassischer CPU-gesteuerter Ansätze.
In diesem Buch lernen Sie:
LEDs und NeoPixel kreativ steuern: Blinken, Dimmen, Farbwechsel und komplexe Animationen
Taster und Encoder zuverlässig auslesen und in Echtzeit in Ihre Projekte integrieren
Analoge Eingänge (ADC) nutzen und Signale digital steuern
Servos präzise ansteuern und Bewegungsabläufe automatisieren
SPI mit PIO umsetzen, um Displays, Sensoren und Module anzusteuern
Menüsysteme und Submenüs auf SPI-Displays realisieren, inklusive Navigation über mehrere Taster
PWM, Signalgenerierung und Frequenzsteuerung für akustische oder visuelle Effekte
Debugging-Strategien und Tipps, um Ihre PIO-Programme effizient zu entwickeln
Alle Beispiele sind praxisnah, sofort umsetzbar und zuverlässig. Mit klaren Anleitungen, Hintergrundwissen und fertigen Codebeispielen lernen Sie, die PIO-Fähigkeiten des Pico maximal zu nutzen – egal ob für Maker-Projekte, Prototypen oder professionelle Anwendungen.
Erleben Sie, wie Sie komplexe Hardwaresteuerung elegant mit dem Pico realisieren können – schneller, flexibler und leistungsfähiger als je zuvor.
Projects with Arduino Uno & Raspberry Pi with Examples for the MCP2515 CAN Bus Interface Module
This book details the use of the Arduino Uno and the Raspberry Pi 4 in practical CAN bus based projects. Using either the Arduino Uno or the Raspberry Pi with off-the-shelf CAN bus interface modules considerably ease developing, debugging, and testing CAN bus based projects.
This book is written for students, practicing engineers, enthusiasts, and for everyone else wanting to learn more about the CAN bus and its applications. The book assumes that the reader has some knowledge of basic electronics. Knowledge of the C and Python programming languages and programming the Arduino Uno using its IDE and Raspberry Pi will be useful, especially if the reader intends to develop microcontroller-based projects using the CAN bus.
The book should be a useful source of reference material for anyone interested in finding answers to questions such as:
What bus systems are available for the automotive industry?
What are the principles of the CAN bus?
How can I create a physical CAN bus?
What types of frames (or data packets) are available in a CAN bus system?
How can errors be detected in a CAN bus system and how dependable is a CAN bus system?
What types of CAN bus controllers exist?
How do I use the MCP2515 CAN bus controller?
How do I create 2-node Arduino Uno-based CAN bus projects?
How do I create 3-node Arduino Uno-based CAN bus projects?
How do I set the acceptance masks and acceptance filters?
How do I analyze data on the CAN bus?
How do I create 2-node Raspberry Pi-based CAN bus projects?
How do I create 3-node Raspberry Pi-based CAN bus projects?
ModbusRTU and ModbusTCP examples with the Arduino Uno and ESP8266
Introduction to PLC programming with OpenPLC, the first fully open source Programmable Logic Controller on the Raspberry Pi, and Modbus examples with Arduino Uno and ESP8266
PLC programming is very common in industry and home automation. This book describes how the Raspberry Pi 4 can be used as a Programmable Logic Controller. Before taking you into the programming, the author starts with the software installation on the Raspberry Pi and the PLC editor on the PC, followed by a description of the hardware.
You'll then find interesting examples in the different programming languages complying with the IEC 61131-3 standard. This manual also explains in detail how to use the PLC editor and how to load and execute the programs on the Raspberry Pi. All IEC languages are explained with examples, starting with LD (Ladder Diagram) over ST (Structured Control Language) to SFC (Special Function Chart). All examples can be downloaded from the author's website.
Networking gets thorough attention too. The Arduino Uno and the ESP8266 are programmed as ModbusRTU or ModbusTCP modules to get access to external peripherals, reading sensors and switching electrical loads. I/O circuits complying with the 24 V industry standard may also be of interest for the reader.
The book ends with an overview of commands for ST and LD. After reading the book, the reader will be able to create his own controllers with the Raspberry Pi.
Een op de Raspberry Pi Pico gebaseerde Eye Catcher
Een standaard zandklok laat meestal slechts zien hoe de tijd verstrijkt. Deze door een Raspberry Pi Pico aangestuurde zandklok toont daarentegen de exacte tijd door de vier cijfers voor uren en minuten in een zandlaag te "graveren". Na een vooraf ingestelde periode wordt het zand door twee trilmotoren vlak getrild en begint alles weer van voren af aan.
Het hart van de zandklok wordt gevormd door twee servomotoren, die via een pantograafmechanisme een schrijfpen aandrijven. Een derde servomotor tilt deze pen op en neer. Het zandbakje is voorzien van twee trilmotoren om het zand weer vlak te trillen. Het elektronische deel van de zandklok bestaat uit een Raspberry Pi Pico en een RTC/driverbord met een real-time klok, plus drivercircuits voor de servomotoren.
Een gedetailleerde bouwhandleiding is beschikbaar via download.
Kenmerken
Afmetingen: 135 x 110 x 80 mm
Bouwtijd: ca. 1,5 tot 2 uur
Inbegrepen
3x Voorgesneden acrylaatplaten met alle mechanische onderdelen
3x Mini servomotoren
2x Trilmotoren
1x Raspberry Pi Pico
1x RTC/driverkaart met geassembleerde onderdelen
Moeren, boutjes, afstandhouders en draden voor de montage
Fijnkorrelig wit zand
2 kanalen • 350 MHz • 1 GSa/s • 50.000 wfm/s • 7 inch Touchscreen
De FNIRSI DPOS350P is een gestroomlijnde 4-in-1 krachtpatser in tabletvorm! Dit compacte en draagbare apparaat biedt serieuze functionaliteit: het combineert een 2-kanaals oscilloscoop (350 MHz), een signaalgenerator (50 MHz), een frequentieresponsanalyzer (50 MHz) en een spectrumanalyzer (200 kHz–350 MHz) – alles in één apparaat.
Of u nu bezig bent met R&D, probleemoplossing of veldtesten, de DPOS350P biedt de tools die u nodig hebt om elektronische signalen nauwkeurig en helder te meten, genereren, analyseren en visualiseren. Het responsieve touchscreen met hoge resolutie en de intuïtieve bediening maken signaalanalyse snel, flexibel en efficiënt.
Kenmerken
Krachtige multifunctionele integratie
350 MHz 2-kanaals oscilloscoop met 1 GSa/s realtime sampling
50 MHz signaalgenerator met 14 standaard + aangepaste golfvormen
Spectrum analyzer (200 kHz–350 MHz): Perfect voor EMI, RF en HF-testen
Frequentieresponsanalyzer (FRA) tot 50 MHz
Hoogwaardige golfvormregistratie
Vernieuwingsfrequentie van 50.000 wfm/s voor realtime signaalhelderheid
Bandbreedte van 350 MHz (enkelkanaalsmodus)
Detecteert zeldzame en onwaarschijnlijke afwijkingen
Scherp display & Soepele werking
7" IPS-touchscreen (resolutie 1024 x 600)
Schakelen tussen grijstinten- en kleurtemperatuurweergave
Eenvoudig te bedienen in verschillende testomgevingen
Betrouwbaar, beveiligd en snel opladen
Hoogspanningsbeveiliging tot 400 V
Snel opladen met QC 18 W (volledig opladen in 2 uur)
Gebouwd voor stabiele, langdurige werking
Gegevensopslag en -export
Sla tot 500 golfvormrecords + 90 screenshots op
USB-export voor eenvoudige rapportage en offline analyse
Specificaties
Algemeen
Scherm
7 inch (IPS, volledige kijkhoek)
Resolutie
1024 x 600 pixels
Interactiemodus
Capacitief touchscreen
Totaal stroomverbruik
10 W
Inschakelconfiguratie
5 voorinstellingen
Opladen
QC 18 W, 12 V/1,5 A (USB-C)
Accu
3,7 V, 8000 mAh lithiumbatterij
Accuduur
ca. 3 uur in gebruik, 5 uur stand-by
Warmteafvoer
Luchtkoeling
Uitbreidingsinterface
USB-poort
Automatische uitschakeling
15 tot 60 minuten / uit
Firmware-upgrade
Ondersteunt .iso-image-upgrade
Talen
Engels / Portugees / Russisch / Chinees
Afmetingen
190 x 128 x 37 mm
Oscilloscoop
Analoge kanalen
2
Analoge bandbreedte
350 MHz
Stijgtijd
1 ns
Real-time bemonsteringsfrequentie
1 GSa/s
Geheugendiepte
60 Kpts
Ingangsimpedantie
1 MΩ / 14PF
Tijdbasisbereik
5 ns ~ 50 s
Roltijdbasis
50 ms ~ 50 s
Verticale gevoeligheid
2 mV ~ 20 V (1X)
Verticaal bereik
16 mV ~ 160 V (1X)
DC-nauwkeurigheid
±2%
Tijd nauwkeurigheid
±0,01%
Ingangskoppeling
DC / AC
Probe-verzwakking
1X / 10X / 100X
Hardwarebandbreedtelimiet
150M / 20M
Hoge-resolutiemodus
8 bit ~ 16 bit
Parametermetingen
12 typen
Cursormeting
Tijd, periode, frequentie, niveau, spanning
Triggerdetectie
Digitale trigger
Triggerkanaal
CH1 / CH2
Triggermodus
Auto / Single / Normal
Triggerflank
Rising edge / Falling edge
Triggeronderdrukking
L1 ~ L3
Triggerniveau
Handmatig / automatisch 10% ~ 90%
Screenshot-opslag
90 afbeeldingen
Golfvormopslag
500 groepen
Achtergrondraster
Weergeven/verbergen
Golfvormbeweging
Grof/fijn afstellen
Overspanningsbeveiliging
Bestandsspanning 400 V
Helderheid golfvorm
Instelbaar
Eenvoudig FFT-display
Ja
Digitale fluorescentie
Ja
Kleurtemperatuurweergave
Ja
X-Y-modus
Ja
ZOOM-tijdbasis
Ja
Automatische aanpassing met één druk op de knop
Ja
Terug naar nul met één druk op de knop
Ja
Gegevensbrowser
Ja
Signaalgenerator
Golfvormtypen
14 standaardfuncties + vastgelegde golfvorm
Frequentie
0~50 MHz (alleen sinusgolf, andere golfvormen tot 10M/5M/3M)
Amplitude
0~5 VPP
Offset
-2,5 V ~ +2,5 V
Bedrijfstype cyclus
0,1~99,9%
Frequentieresolutie
1 Hz
Amplituderesolutie
1 mV
Offsetresolutie
1 mV
Inschakelduurresolutie
0,1%
Aanpasbare vastgelegde golfvorm
500 groepen
Frequentieresponsanalyzer (FRA)
Frequentie van het excitatiesignaal
100 Hz ~ 50 MHz
Ampitude van het excitatiesignaal
0~5 VPP
Offset van het excitatiesignaal
-2,5 V ~ +2,5 V
Aantal excitatiefrequenties
20~500
Cursormeting
Frequentie / versterking / fase
Bedrijfsmodus
Enkelvoudig / cyclisch
Systeemkalibratie
Ja
Spectrumanalyzer
Conversiemethode
FFT
FFT-lengte
4K ~ 32K
Frequentiebereik
200 kHz ~ 350 MHz
Niveaubereik
-60 dBmV ~ +260 dBmV
Cursormeting
Frequentie / amplitude
Markeringsparameter
Maximale energieharmonischen
Watervalgrafiek
Ja
3D-watervalgrafiek
Ja
Automatische afstelling
Ja
Systeemkalibratie
Ja
Inbegrepen
1x FNIRSI DPOS350P (4-in-1)
2x 350 MHz-sondes
1x QC 18 W snellader (EU)
1x USB-datakabel
1x Krokodillenklem
1x Opbergtas
1x Manual
Downloads
Manual
Firmware