際際滷

際際滷Share a Scribd company logo
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Building a Raspberry Pi
Robot Arm with .NET 6,
Blazor and SignalR
PETE GALLAGHER
PETECODES.CO.UK
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
About Me
Pete Gallagher
@pete_codes
www.PeteCodes.co.uk
pete@pjgcreations.co.uk
Freelance IoT Consultant at PJG Creations Ltd
Microsoft Certified Trainer & Azure MVP, Pluralsight Author
Decades of Desktop, Web & Embedded Software experience,
Meetup Organiser,
STEM Ambassador, Code Club Organiser  Gadget Addict
Father of two inquisitive girls
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
What were going to be doing
 .NET 6
 Installing .NET 6
 Raspberry Pi GPIO and the Circuit
 Hello World (In the world of IoT)
 Device Bindings and Driving Servos
 Blazor and SignalR
 Final Demos
 Q&A
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
.NET 6
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
.NET 6
INFRASTRUCTURE
.NET STANDARD
.NET is a software development platform
DESKTOP WEB CLOUD MOBILE GAMING IoT AI
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Whats new in .NET 6?
 ARM64 Support
 .NET MAUI
 Global Using
 File-Scoped Namespaces
 HTTP/3
 Record Structs
 Async Main
http://bit.ly/dotnet6newfeatures
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
.NET Ecosystem Momentum
> 1.5M
.NET Core Developers
In Visual Studio
#1 Most Loved
Framework
.NET Core
Top 30
Highest velocity OSS Projects
github.com/dotnet
github.com/aspnet
Top 5
Language on GitHub
C#
7x
Faster than Node.js
ASP.NET Core
40%
New to .NET are students
dot.net download survey
Build 2020  Journey to one .NET - https://www.youtube.com/watch?v=ctSqiD8BGPM
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi Install
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi Install
Single Line Install
wget -O - https://raw.githubusercontent.com/pjgpetecodes/dotnet6pi/master/install.sh | sudo bash
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
.NET 6 & GPIO
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
System.Device.Gpio
 Supports I/O, SPI, PWM, I2C
 Supports Raspberry Pi, Beagleboard,
Hummingboard, Odroid etc
 Supports Linux and Windows 10 IoT
 Installs via the CLI or Nuget PM
https://www.nuget.org/packages/
System.Device.Gpio
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi GPIO
Board Numbering
BCM Numbering
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi Circuit 1
Pin 10
Pin 26
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi Demo 1
Hello World (In the world of IoT)
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Iot.Device.Bindings
 Support for
BME280 Temp / Humidity Sensor
MCP23xxx I/O Expander
Explorer Hat
Sense Hat
Servos
Much more
https://www.nuget.org/packages/
Iot.Device.Bindings
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi Circuit 2
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Servo Control Board
Pin 25
Pin 35
Pin 13
Pin 12
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Servos
Control
Power
Ground
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Servos
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi Demo 2
Servo Demo
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Blazor
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Blazor is a single-page app
framework for building
interactive client-side Web
apps with .NET
Scott Hansleman
Blazor
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Blazor
 Started Life as Steve Sandersons Pet Project
 Web UI Framework based in C#
 Replaces JavaScript
 Razor and HTML
 Server Side or Client Side WebAssembley
 Client Side .NET with no plugins
 Support in most modern Browsers
https://bit.ly/pjgblazor
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
SignalR
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
ASP.NET SignalR is a library for
ASP.NET developers to add real-
time web functionality to their
applications
Wikipedia
SignalR
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
SignalR
 Open Source
 Created by David Fowler
and Damian Edwards in 2011
 Enables Bi-directional
Real-Time communications
 Supports;
Web Sockets
Server-Sent Events
Long Polling
https://bit.ly/pjgsignalr
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi Demo 3
Drive the Arm!
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Unity and VR
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Unity is a Cross-Platform Game
Engine
Unity gives users the ability to
create games and experiences in
both 2D and 3D
Wikipedia
Unity and VR
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Unity and VR
 Founded in 2002
 Nicholas Francis, Joachim Ante, and David Helgason
 Cross platform deployment
 Supports VR headsets
 C#
 .NET Standard 2.0 and .NET 4.x
 Add Nuget Packages
https://unity.com/
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Raspberry Pi Demo 4
VR Robots!
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Links
 GitHub and Workshop
https://bit.ly/dotnet5robotarmrepo
 C# 10 + Dot Net 6
http://bit.ly/pjgdotnet6announcement
 Installing Dot Net 6 on the Raspberry Pi
http://bit.ly/dotnet6pi
 Dot Net GPIO Nuget Package
https://www.nuget.org/packages/System.Device.Gpio
 Dot Net IoT Device Bindings Source Code
https://github.com/dotnet/iot/tree/master/src/devices
 3D Printed Robot Arm  From the presentation
https://www.thingiverse.com/thing:1015238
 3D Printed Robot Arm - Workshop
http://bit.ly/pjgrobotarmparts
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Links
Blazor
https://bit.ly/pjgblazor
MatBlazor
https://www.matblazor.com/
Awesome Blazor
https://github.com/AdrienTorris/awesome-blazor
SignalR
https://bit.ly/pjgsignalr
Uno Platform
https://bit.ly/pjgunoplatform
IoTeaLive
https://twitch.tv/azureishlive
pluralsight.pxf.io/az220
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
 Twitter
@pete_codes
 Email:
pete@pjgcreations.co.uk
 Personal Website:
https://www.petecodes.co.uk
Notts IoT:
https://www.nottsiot.co.uk
 Dot Net Notts:
https://www.dotnetnotts.co
 Notts Dev Workshop:
https://www.nottsdevworkshop.co.uk
 LATi:
https://www.lati.org.uk
 Agile Engineering Podcast:
https://agileengineeringpodcast.com/
 Azureish Live:
https://www.twitch.tv/azureishlive
Contact Me
際際滷s: https://bit.ly/pjgndcmelbourne2022
Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR  Copyright Pete Gallagher 2022  @Pete_Codes
Contact Me
Pete Gallagher
@pete_codes /
@PJGCreations
www.PeteCodes.co.uk
www.PJGCreations.co.uk
Pete@PJGCreations.co.uk
際際滷s: https://bit.ly/pjgyorkshiredotnet2022

More Related Content

Building a Raspberry Pi Robot with Dot NET 6, Blazor and SignalR - Yorkshire .NET 2022

  • 1. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Building a Raspberry Pi Robot Arm with .NET 6, Blazor and SignalR PETE GALLAGHER PETECODES.CO.UK
  • 2. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes About Me Pete Gallagher @pete_codes www.PeteCodes.co.uk pete@pjgcreations.co.uk Freelance IoT Consultant at PJG Creations Ltd Microsoft Certified Trainer & Azure MVP, Pluralsight Author Decades of Desktop, Web & Embedded Software experience, Meetup Organiser, STEM Ambassador, Code Club Organiser Gadget Addict Father of two inquisitive girls
  • 3. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes What were going to be doing .NET 6 Installing .NET 6 Raspberry Pi GPIO and the Circuit Hello World (In the world of IoT) Device Bindings and Driving Servos Blazor and SignalR Final Demos Q&A
  • 4. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes .NET 6
  • 5. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes .NET 6 INFRASTRUCTURE .NET STANDARD .NET is a software development platform DESKTOP WEB CLOUD MOBILE GAMING IoT AI
  • 6. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Whats new in .NET 6? ARM64 Support .NET MAUI Global Using File-Scoped Namespaces HTTP/3 Record Structs Async Main http://bit.ly/dotnet6newfeatures
  • 7. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes .NET Ecosystem Momentum > 1.5M .NET Core Developers In Visual Studio #1 Most Loved Framework .NET Core Top 30 Highest velocity OSS Projects github.com/dotnet github.com/aspnet Top 5 Language on GitHub C# 7x Faster than Node.js ASP.NET Core 40% New to .NET are students dot.net download survey Build 2020 Journey to one .NET - https://www.youtube.com/watch?v=ctSqiD8BGPM
  • 8. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi Install
  • 9. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi Install Single Line Install wget -O - https://raw.githubusercontent.com/pjgpetecodes/dotnet6pi/master/install.sh | sudo bash
  • 10. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes .NET 6 & GPIO
  • 11. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes System.Device.Gpio Supports I/O, SPI, PWM, I2C Supports Raspberry Pi, Beagleboard, Hummingboard, Odroid etc Supports Linux and Windows 10 IoT Installs via the CLI or Nuget PM https://www.nuget.org/packages/ System.Device.Gpio
  • 12. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi GPIO Board Numbering BCM Numbering
  • 13. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi Circuit 1 Pin 10 Pin 26
  • 14. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi Demo 1 Hello World (In the world of IoT)
  • 15. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Iot.Device.Bindings Support for BME280 Temp / Humidity Sensor MCP23xxx I/O Expander Explorer Hat Sense Hat Servos Much more https://www.nuget.org/packages/ Iot.Device.Bindings
  • 16. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi Circuit 2
  • 17. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Servo Control Board Pin 25 Pin 35 Pin 13 Pin 12
  • 18. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Servos Control Power Ground
  • 19. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Servos
  • 20. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi Demo 2 Servo Demo
  • 21. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Blazor
  • 22. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Blazor is a single-page app framework for building interactive client-side Web apps with .NET Scott Hansleman Blazor
  • 23. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Blazor Started Life as Steve Sandersons Pet Project Web UI Framework based in C# Replaces JavaScript Razor and HTML Server Side or Client Side WebAssembley Client Side .NET with no plugins Support in most modern Browsers https://bit.ly/pjgblazor
  • 24. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes SignalR
  • 25. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes ASP.NET SignalR is a library for ASP.NET developers to add real- time web functionality to their applications Wikipedia SignalR
  • 26. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes SignalR Open Source Created by David Fowler and Damian Edwards in 2011 Enables Bi-directional Real-Time communications Supports; Web Sockets Server-Sent Events Long Polling https://bit.ly/pjgsignalr
  • 27. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi Demo 3 Drive the Arm!
  • 28. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Unity and VR
  • 29. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Unity is a Cross-Platform Game Engine Unity gives users the ability to create games and experiences in both 2D and 3D Wikipedia Unity and VR
  • 30. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Unity and VR Founded in 2002 Nicholas Francis, Joachim Ante, and David Helgason Cross platform deployment Supports VR headsets C# .NET Standard 2.0 and .NET 4.x Add Nuget Packages https://unity.com/
  • 31. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Raspberry Pi Demo 4 VR Robots!
  • 32. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Links GitHub and Workshop https://bit.ly/dotnet5robotarmrepo C# 10 + Dot Net 6 http://bit.ly/pjgdotnet6announcement Installing Dot Net 6 on the Raspberry Pi http://bit.ly/dotnet6pi Dot Net GPIO Nuget Package https://www.nuget.org/packages/System.Device.Gpio Dot Net IoT Device Bindings Source Code https://github.com/dotnet/iot/tree/master/src/devices 3D Printed Robot Arm From the presentation https://www.thingiverse.com/thing:1015238 3D Printed Robot Arm - Workshop http://bit.ly/pjgrobotarmparts
  • 33. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Links Blazor https://bit.ly/pjgblazor MatBlazor https://www.matblazor.com/ Awesome Blazor https://github.com/AdrienTorris/awesome-blazor SignalR https://bit.ly/pjgsignalr Uno Platform https://bit.ly/pjgunoplatform
  • 36. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Twitter @pete_codes Email: pete@pjgcreations.co.uk Personal Website: https://www.petecodes.co.uk Notts IoT: https://www.nottsiot.co.uk Dot Net Notts: https://www.dotnetnotts.co Notts Dev Workshop: https://www.nottsdevworkshop.co.uk LATi: https://www.lati.org.uk Agile Engineering Podcast: https://agileengineeringpodcast.com/ Azureish Live: https://www.twitch.tv/azureishlive Contact Me 際際滷s: https://bit.ly/pjgndcmelbourne2022
  • 37. Building a Robot Arm with Raspberry Pi, .NET 6, Blazor & SignalR Copyright Pete Gallagher 2022 @Pete_Codes Contact Me Pete Gallagher @pete_codes / @PJGCreations www.PeteCodes.co.uk www.PJGCreations.co.uk Pete@PJGCreations.co.uk 際際滷s: https://bit.ly/pjgyorkshiredotnet2022

Editor's Notes

  • #6: .NET is an entire software development platform that takes care of a lot of the heavy lifting for you when you want to build an application. Applications frameworks help you build the specific types of apps or workloads and enable you to literally build any app for any platform with any operating system. Each .NET workload shares a common infrastructure and .NET Standard library. This means not only are your .NET skills portable, but your actual code is portable no matter what youre building. This makes it easy to share reusable components (called libraries) across the breadth of applications people build. Additionally, there are a broad set of development tools that makes it really productive to write, debug, build and manage code bases. See: www.dot.net
  • #8: Build 2020 Journey to one .NET - https://www.youtube.com/watch?v=ctSqiD8BGPM https://insights.stackoverflow.com/survey/2019#technology-most-loved-dreaded-and-wanted-loved3 github.com/cncf/velocity octoverse.github.com www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=plaintext
  • #21: Each PWM Channel is created passing in; The Chip Number The PWM Channel The Frquency Optionally, the Duty Cycle Percentage We also then create twoServoMotorobjects, passing in; The PWM Channel we'll be using The Maximum Angle of the Servo - We're using a 180 degree Servo, so we pass in 180 here The Minimum Pulse Width The Maximum Pulse Width
  • #23: Blazor replaces javascript and runs C# on the client side directly in the browsers with no plugins needed. Blazor Server Works as a web Server (Shipped) Blazor Web Assembly (May 2020) Blazor Renders HTML, but Blazor Native but can render to other things like Native Controls for Mobile.
  • #24: Blazor replaces javascript and runs C# on the client side directly in the browsers with no plugins needed. Blazor Server Works as a web Server (Shipped) Blazor Web Assembly (May 2020) Blazor Renders HTML, but Blazor Native but can render to other things like Native Controls for Mobile. Originally developed as a pet project bySteve Sandersonat Microsoft, Blazor is Web UI Framework which is based on C#, Razor and HTML. Blazor compiles down to WebAssembly, which makes it super (or blazingly) fast (Hence the Razor with a B). Blazor allows developers to write client side .net You may say Oh, like Silverlight? Nope, no plugins needed Its just supported natively in most modern browsers.
  • #28: Server: Hubs ChatHub Startup.cs using BlazorSignalRApp.Server.Hubs; ConfigureServices services.AddSignalR(); app.useEndpoint endpoints.MapHub<ChatHub>("/chathub"); Properties Launchconfig applicationUrl Client Pages Index.razor _imports.rzor Wwwroot Index.html