Go Even Further Without Wires
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Subtitle |
| |
Title of Series | ||
Number of Parts | 542 | |
Author | ||
Contributors | ||
License | CC Attribution 2.0 Belgium: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/62052 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
FOSDEM 202356 / 542
2
5
10
14
15
16
22
24
27
29
31
36
43
48
56
63
74
78
83
87
89
95
96
99
104
106
107
117
119
121
122
125
126
128
130
132
134
135
136
141
143
146
148
152
155
157
159
161
165
166
168
170
173
176
180
181
185
191
194
196
197
198
199
206
207
209
210
211
212
216
219
220
227
228
229
231
232
233
236
250
252
256
258
260
263
264
267
271
273
275
276
278
282
286
292
293
298
299
300
302
312
316
321
322
324
339
341
342
343
344
351
352
354
355
356
357
359
369
370
372
373
376
378
379
380
382
383
387
390
394
395
401
405
406
410
411
413
415
416
421
426
430
437
438
440
441
443
444
445
446
448
449
450
451
458
464
468
472
475
476
479
481
493
494
498
499
502
509
513
516
517
520
522
524
525
531
534
535
537
538
541
00:00
Level (video gaming)Machine code2 (number)Lecture/Conference
00:20
Price indexPressureSoftware developerWindowInternetworkingComputer animationLecture/Conference
01:08
Computer programmingGroup actionOpen sourceAreaResultantCollaborationismLecture/ConferenceComputer animation
01:51
Wide area networkAreaLocal ringCommunications protocolLecture/ConferenceComputer animation
02:15
Power (physics)Order (biology)Digital signalTelecommunicationWireless LANOSI modelPower (physics)Spectrum (functional analysis)Category of beingPhysicalismLecture/ConferenceComputer animation
03:09
TouchscreenAdditionFrequencyComputer animationLecture/Conference
03:38
DistanceCommunications protocolComputer animationEngineering drawing
04:07
Game controllerInterface (computing)PeripheralSerial portSerial portSeries (mathematics)Lecture/ConferenceComputer animation
04:34
MicrocontrollerCompilerComputer programmingLecture/ConferenceComputer animation
04:59
Data typePrice indexGamma functionView (database)Computer fileCore dumpSign (mathematics)Charge carrierTerm (mathematics)VideoconferencingDigital photographySpherical capOnline helpLecture/ConferenceComputer animation
05:36
MicrocontrollerBitFocus (optics)Multi-core processorArmComputer animation
05:54
Session Initiation ProtocolCodeView (database)Computer fileCore dumpComputer-generated imageryUsabilityDiagramPrice indexPower (physics)Flash memory32-bitComputer programmingLecture/Conference
06:13
CodeComputer fileView (database)Lemma (mathematics)MicrocontrollerVirtual machineMultiplication signFunctional (mathematics)CodeDirection (geometry)Computer hardware
06:39
Computer fileView (database)World Wide Web ConsortiumArithmetic meanWhiteboardConfiguration spaceLecture/Conference
07:02
Core dumpMiniDiscFlash memoryComputer programmingComputer animation
07:24
Computer fileDivision (mathematics)Computer programmingType theoryFlash memoryArithmetic meanWhiteboardComputer animationLecture/Conference
07:49
Computer fileActive contour modelError messageCodeAsynchronous Transfer ModeDemo (music)Sign (mathematics)Demo (music)GodComputer animation
08:09
Device driverDevice driverDemo (music)Wireless LANDifferent (Kate Ryan album)Adaptive behaviorCommunications protocolLecture/ConferenceComputer animation
08:43
Different (Kate Ryan album)Computer animation
08:59
Order (biology)Broadcasting (networking)CodeComputer animationLecture/Conference
09:22
CodeComputer fileView (database)Virtual machineElectronic visual displayGamma functionLemma (mathematics)Term (mathematics)Virtual machineDevice driverTelecommunicationLecture/Conference
09:47
CodeComputer fileView (database)Virtual machinePersonal identification numberVisual systemStandard deviationGamma functionGame theoryDevice driverBounded variationInterface (computing)
10:06
View (database)Computer fileMaxima and minimaGamma functionVisual systemCodeGame theoryVirtual machinePersonal identification numberConfiguration spaceBand matrixLecture/Conference
10:29
Lemma (mathematics)Computer fileView (database)CodeVirtual machinePersonal identification numberAugmented realityGamma functionLecture/Conference
10:46
View (database)Computer fileGamma functionMessage passingDemo (music)GodComputer animationLecture/Conference
11:04
Demo (music)Error messageCodeMusical ensembleWireless LANComputer animation
11:27
2 (number)Serial portLecture/Conference
11:44
Error messageDemo (music)Computer animation
12:02
Video gameGroup actionComputer animationLecture/Conference
12:25
Gamma functionElectronic visual displayDifferent (Kate Ryan album)Computer programmingBitLecture/ConferenceComputer animation
12:50
Computer animation
13:09
Discrete element methodComputer programming2 (number)Computer animation
13:31
Virtual machineLecture/Conference
14:06
HypermediaMessage passing
14:24
Multiplication signLatent heatQuicksortLecture/Conference
14:49
Wide area networkMereologyPoint cloudRight angleLecture/Conference
15:07
Computer networkGateway (telecommunications)Server (computing)InternetworkingAddress spaceHypermediaGame controllerGateway (telecommunications)Computer architectureBitLecture/ConferenceComputer animation
15:33
Computer networkLattice (order)Server (computing)Multiplication signInternetworkingGateway (telecommunications)Server (computing)Cartesian coordinate systemSoftwareCommunications protocolConnectivity (graph theory)Lecture/ConferenceComputer animation
15:57
Goodness of fitServer (computing)SpacetimeLecture/ConferenceComputer animation
16:26
FreewareStack (abstract data type)BitService (economics)Front and back endsLibrary (computing)Computer animationLecture/Conference
16:49
Discrete element methodKey (cryptography)Internet service providerPattern languagePower (physics)MereologyComputer animation
17:32
Decision theoryKey (cryptography)Point cloudServer (computing)Perfect groupLecture/Conference
17:52
Distribution (mathematics)Computer networkServer (computing)LaptopComputerSocial classMobile appComputer animationProgram flowchart
18:27
LaptopComputerLecture/ConferenceComputer animation
18:50
Lemma (mathematics)ComputerAnalogyDegree (graph theory)LaptopoutputExecution unitOcean currentStatisticsCentralizer and normalizerMultiplication signComputer animationLecture/ConferenceMeeting/Interview
19:49
MereologyPlastikkarteSoftware development kitBranch (computer science)Continuum hypothesisLecture/ConferenceMeeting/Interview
21:34
Program flowchart
Transcript: English(auto-generated)
00:05
While Ron is setting up these slides, I'll quickly introduce him. I have a lot of things to say about him, but he's already learning late. But I've never seen such dedication to even five seconds before he came on stage debugging his codes. I've never seen such dedication for a talk.
00:21
I think this is true conference-driven development. Thank you, Ron! At FOSTAM 2021, we learned to go without wires. And we discovered Go Bluetooth,
00:41
a new package that let you use Go to connect with Bluetooth, not just on microcontrollers, but on Windows. Yes, I said Windows. Here at FOSTAM, I'm very brave. On Windows, on Mac OS, and on Linux. Then, at FOSTAM 2022, we learned to go further without wires.
01:02
And we discovered the mysteries of Wi-Fi and the internets. Now, at FOSTAM 2023, we will go even further without wires. This time, we go long. I am Ron Evans, dead program.
01:22
I am technologist-for-hire, aren't we all these days, of the hybrid group I microconsultancy here on planet Earth, where we're all technologists-for-hire. So we do a lot of open source work, usually for little or no renumeration. And TinyGo is the result of the amazing collaborations of a huge community of people all over the world.
01:42
So this is about going further without wires. So what we're actually talking about here is low-powered wide area networking, or LPWAN. So we talked about personal area networking two years ago, local area networking, and now we're going for wide area networking. And, of course, we're talking about LoRa and LoRaWAN.
02:03
So what is LoRa? That's a very good question. Maybe we should ask who is LoRa or why is LoRa, but let's start with what is LoRa. So LoRa is, of course, long-range radio. It is a semi-proprietary but freely licensed protocol
02:20
that was created in order to do long-range wireless communication of digital data. And, yes, I had to ask why is LoRa. Well, long-range, of course, I mean, you knew that from the name, right? Ultra low power. Not just low power, but ultra low power. And license-free spectrum.
02:40
That means you do not need to go to any governmental entities and ask permissions. But that does not mean free for all. That just means we must share the commons gently because these airwaves are, in fact, the property of all human beings. So LoRa is the physical layer protocol.
03:01
And what we mean by that is it actually tells us when the radio signal comes whether it's a one or a zero. So a question, what do these three things have in common? A bat? A dolphin? The screen star of the 20th century, Hedy Lamarr?
03:22
I know you're probably wondering. The answer is, of course, chirp spread spectrum. You have that, right? So Hedy Lamarr, in addition to being an actress, probably many people know, was an inventor of what is now known as frequency hopping, which was a technology that was used to avoid jamming and detection during World War II.
03:41
And we use this today for the LoRa protocol. So to kind of get you an idea, there's an up chirp and a down chirp. So I will now imitate the up chirp. And the down chirp. I'm like, imagine that in a cute little dolphin voice. So by being able to parse and modulate these signals,
04:00
it's able to actually send across long distances using very low power. So how to use LoRa? Well, chips, of course. Thank you. Good night. Chips mostly from Semtech. So Semtech is a company that are the creators of the LoRa protocol, and they make most of the chips and they license them out. The two that are the most common are the SX126X series
04:23
and the SX127 series. And so what we're going to do is we're going to see you have a microcontroller, some type of device, and we're going to connect through the serial peripheral interface, which is a low-level serial interface, to the actual LoRa chipset, and then with the antenna, talk out to someplace far, far away.
04:42
So this is where TinyGo comes in, right? You knew that when we saw a microcontroller. So the Go compiler for small places. If you haven't checked it out, you can program Arduinos with Go. You'll see in a minute. So let's start with the Holo world of things, which, of course, is a blinky LED. And we're going to start with a Raspberry Pi Pico,
05:01
which, oh, I forgot to start my video. Let's see here. You need some, actually, to see what's going on, or it's not quite as exciting. Well, let's see here. Yes, I use all Linux tools, don't we all? Let's see if the camera will come up.
05:23
Oh, wrong camera. It looks like, well, I think that is, I forgot to take the lens cap off. Oh, that helps. No, I am not a professional photographer by trade. And, of course, if we make that bigger, it's a lot easier to see. And we can even bring it into a little bit of focus. All right, so this is a Raspberry Pi Pico RP2040,
05:44
which is a microcontroller made by Raspberry Pi. And, as we were seeing a minute ago, it's got a dual-core ARM Cortex N0, which is a very, very low-powered, not very powerful ARM Cortex microcontroller, 32-bit. Runs at 133 megahertz and two megabytes of flash.
06:03
So, let's just take a quick look at some code, just so you get an idea of what it is that we're looking at. And the whole world of things is a very simple program. You can see this kid. All right, so it's just a Go program, right? But it's run through the TinyGo compiler, and it compiles to the code that can actually run
06:22
on the microcontroller. So, we'll import the machine package, which is a special package TinyGo uses to communicate with the hardware directly. Then the time package, same time package. And our function main, you've seen this before. So, first we're going to say LED colon equals machine LED, which is like the built-in LED that's on a lot of boards.
06:42
We'll configure that as an output, meaning we're going to send a signal to it to turn it on. And then forever, we're going to turn it low, meaning off. We're going to wait for 500 milliseconds, half a second, turn it on, and then wait for another 500 milliseconds.
07:00
All right, so let's go and let's see this actually work. So, if we go back to my press up, there we go. And if we make blinky, I really like make. So, we'll then compile that code, flash it on there,
07:21
and you can see that it's a 7K program. Can you see that? Yeah, it's really small, both the type and the program. And then if we go and we take a look, if we, oh, I forgot to plug it in. I was a little rushed for time, I'll admit.
07:42
Naturally, it failed the flash. That would have been frightening if it had. There is no wireless in there yet. It's very inexpensive, meaning there's no wireless built on board. All right, so now it's flashed, and if we take a look, we can see an LED is turning on and off. Yes!
08:01
All right, we're off to a good start. I tempted the demo gods quite a lot today. So, now we're going to use the TinyGo drivers package, which is a package that is a sister package to the TinyGo compiler, which contains support for all different kinds of sensors, of displays,
08:22
and other interesting things like, for example, our LoRa wireless adapters. So, our first demo is going to be showing LoRa, just a low-level protocol transmitting and receiving. And we're going to use the same Raspberry Pi Pico, but we're going to add to it an RF solutions lambda 62.
08:42
So, if we can actually take a look at that here. If we go to the video, we'll take away that one, and we'll put in this one. Different Raspberry Pi, and it's wired up to one of those chips that I showed you before. This, by the way, is the antenna. This little wire.
09:00
Do I tell you that? I think I do. Yes. It's a Semtech SX1262 with an 868 megahertz radio, is what you need in order to be legal and broadcast here in the European region. And it's got a wire antenna, which is literally just a short piece of wire. And so, if we take a quick look at the code
09:23
of our SX1266, so we can see it's not that much longer. It's got a package main, our machine package, time, and now we bring in the drivers for LoRa, which is the actual communication for LoRa, and then for the chip itself.
09:40
And what we're going to do here in our main is we'll start by sleeping, and then we'll set up the LoRa interface, and then we'll try to receive data, transmit some data, and then sleep. So setting up the LoRa interface is really just about configuring the SPI interface, the SPI interface, creating the driver that we need
10:01
in the TinyGo drivers package, attaching a radio controller, which because these chips have so many different variations that we need to be able to do so we can tell it which wires are going to be turning it on and off, and then make sure we actually have the device detected, configure it appropriately.
10:20
So here we've got our 868.1 MHz frequency, the bandwidth that we're using, et cetera, and then once we've got that configured, if you recall, we have our setup, then we'll receive data. So to receive, it's just a matter of saying LoRaRadio.Rx, and then how long we should wait, and if we don't receive any data,
10:41
time out and return. And then transmit is almost exactly the same thing. That's going to be transmitting this message here, which is from RP2040 saying, Hello, TinyGo, and then it's going to use LoRa.Rx. All right, let's see if it actually works.
11:01
The demo gods are just waiting, waiting for their chance. All right, so let's actually plug that in this time, since we are professionals, and let's run make, which will now flash that code,
11:22
and that one's a whole 15K. Yeah, you have to add something to go wireless. All right, and we're actually using one of the capabilities we added into TinyGo two releases ago, which is it's got a built-in serial monitor, so we can see it's trying to receive LoRa data for 10 seconds.
11:41
There's no one sending, apparently. And then it will try to, after that, it'll try to send. So because there's no one sending, wait, what? Who is that? That's my next demo.
12:02
All right, the Yo badge. You may have seen several of us are wearing these Go badges. So the Go badge is a, it started out like, oh wow, it's upside down. It started out life as an Adafruit Pi badge,
12:22
but we helped it transition to its final form, a Go badge. And it's much happier now, I can tell you. I mean, just look at its display. Not to mention that we've got such cute stickers. So we're actually running a different TinyGo program on there, which is called Yo badge.
12:40
So Yo badge is using the Adafruit Pi badge. I told you about that a little bit. And it's using this Adafruit LoRa Featherwing, which is a little daughterboard that can be added to some of these. I soldiered it on here. It's got a UFL antenna, which is one of those little antennas that clip on.
13:02
That way you can wear it as a badge because, I mean, it is, in fact, a badge. And then, naturally, I need to reboot it. Okay. So you can see the cool Yo logo. And then, because the other program is still running,
13:25
remember, it's plugged in. The Adafruit Pi is still plugged in. So we could say Yo to it, and within like ten seconds or so, it should say something back. Let's see. Let's see if it's still here.
13:41
Oh! Yep. That was it. The machines are talking to us, and we're talking back. I feel so warm. I really like machines, if you hadn't noticed that. All right. So now let's talk about LoRaWAN.
14:00
Because this was all just peer-to-peer, which, actually, before I do that, just real quick before I do that, so we brought a few of these Go badges, the giveaway, here today to some very special, lucky individuals. We'll do that this afternoon. So if you go on Mastodon or any of those other social media things that you're still using, and you send out some really great messages
14:20
about how awesome TinyGo is and how cool FOSDEM is and how you really would like to be one of the kids with a programmable badge with wireless, then we'll sort of arbitrarily decide who gets these badges. Maybe random. I don't have time to write any more software. All right. So we don't have that much time left.
14:41
So LoRaWAN. Now we're going to go really wide. So the first LoRaWAN specification was actually created in January 2015. So we're not cutting edge here, my friends. We're just catching up on what the cool kids have been doing since back when they were kids. So this is the WAN part of the talk,
15:00
which means the cloud. Take a refreshing breath. All right. So that means routable packets. I mean, if you want to go between Internet works, generally we use media access control addresses or MAC addresses. You've seen these and wondered, that's so ugly. But we need this because with LoRaWAN,
15:21
our architecture is a bit more complex. We have our end devices, as you saw, like the badge, and they talk to a LoRa gateway. And the gateway is what I was trying to get working before, but I had to do a router reset and I didn't have time to finish. I apologize. They didn't give me an Ethernet cable. They were worried about what I would do with it.
15:42
I don't know why. Anyway, the gateway then has a backhaul to the Internets. And that's where the LoRaWAN protocol has three components that are very important. The join server, the network server, and then the application server. So by the way, LoRaWAN is already running on Go.
16:03
Go is in all the good places and it's already LoRaWAN. What do I mean? Well, you may have heard of a company called The Things Network. Very, very cool company. Real pioneers in the space. And they have a complete stack for a LoRaWAN server back end
16:21
that's all written entirely in Go. Come on, give it up for them. Not to mention an awesome free public service. And then ChirpStack, a little bit more recent entry. They're actually doing amazing stuff with a similarly entirely in Go back end stack for LoRaWAN. And they have a lot of cool tools
16:41
and libraries that we're using. So give it up for them. We're talking about devices here. I mean, they've already got Go on the back end. We don't need to reinvent that wheel. They're doing amazing work. No, we're talking about the actual end devices here. And the most important part starts with device activation.
17:00
So device activation is like when you buy a phone and it turns on. You don't have to keep logging into your phone. Maybe you should be. But let's skip over that. That's another talk. So it connects. It's activated. You go to your cellular provider. And now you just start making calls. Well, this is the same model, the same pattern that we use with LoRaWAN. And there's two kinds of activation.
17:21
One is activation by personalization, which means pre-saved keys on the device itself. Uh-oh. We're running out of power. 4%. The question is, what do I unplug? It's a tough decision. Well, and also, I don't have my adapter with me. You only have five minutes, so go.
17:41
Oh, perfect. And then over-the-air activation, which means that you just connect to some server somewhere and you get your keys down from the cloud and then you save those and then you can use those. And then you use those for uplink and downlink. And one thing to remember that's really important
18:01
is that with uplink and downlink in LoRaWAN, there is really only uplink. You uplink and then you maybe get a chance to download some data. So this is the reason why it's so low power. It mostly talks and doesn't really listen, which is the opposite of the app I showed you before, which is just a peer-to-peer thing. So we have lower gateways.
18:21
That's what this awesome antenna here is. It's a micro-tick-not that I couldn't get rebooted in time with a Yagi antenna. And this is a very powerful antenna. And you'll see what this is all about tomorrow. What do I mean? What I mean is Tiny Globo, a Pico high-altitude balloon.
18:41
So if you go to tinyglobo.com, and we'll see if we have internet. Yes, it will redirect you to this page, which is showing you when it's turned on the actual current location, altitude, and stats of the high-altitude balloon. This balloon we will be launching tomorrow
19:02
here at FOSDEM. Uh-oh, I think it may have fallen asleep. No? 12 noon Central European time, weather permitting, of course. And that's the end of the talk.
19:26
That's the best ending ever. We still have some time for questions, weirdly enough. Thank you, battery. How did that happen? I have no idea. Any questions for Ron? I'm sure you have a lot of questions.
19:45
Apparently no questions. Sorry, sorry, sorry. Hi. Have you ever managed to compile the whole Raspberry Pico SDK in C and then import it successfully in TinyGo?
20:00
I'm sorry, could you repeat the first part of the question? Have you ever managed to successfully compile the whole SDK for Raspberry Pi Pico and then successfully import it in TinyGo? Because a year ago it didn't work. Well, so the question is, can we import the Raspberry Pi C SDK and then compile it into TinyGo?
20:22
The answer is, I'm not really sure. Actually, I think you can, but that's not something we're really trying to do. You're probably interested in the Wi-Fi support. Watchdog, for example. Most things are probably better implemented in TinyGo itself. There is no Watchdog in TinyGo?
20:41
There is a branch with a Watchdog, WDT, experimental branch for it. Check that out, but yes. Watchdog, low-power, and bringing in C, those are all things that are part of the TinyGo continuum.
21:02
So it's 12 noon tomorrow. Look for us outside somewhere. You'll notice by this antenna. Look for this antenna and some people wearing glowing helmets with actual balloons at the back of my hotel room. And by the way, all the parts are of Chinese origin, but it was made by these American hands. Thank you.
21:25
Thank you very much. And please do not tell the government about tomorrow. I'm sorry I don't have any cards. No worries.