We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

IoT programming with openSUSE

00:00

Formal Metadata

Title
IoT programming with openSUSE
Title of Series
Number of Parts
40
Author
Contributors
License
CC Attribution 3.0 Unported:
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
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Small networked devices, commonly named Internet of Things (IoT), lead the next revolution in information technology. This talk will present the software and tools available on openSUSE to participate in this revolution. We will especially look at the 'Arduino' IDE to program Arduino, ESP8266, Wemos, ESP32, and similar devices.
Computer-generated imageryPresentation of a groupOpen sourceHacker (term)Product (business)Computing platformGoogolComputer programService (economics)Computing platformProduct (business)Internet der DingeBitOpen sourceOffice suiteMultiplication signHacker (term)Core dumpComputer animationUML
Connectivity (graph theory)Extension (kinesiology)InternetworkingOpen sourceObject (grammar)Computer hardwareForm (programming)Internet der DingeBefehlsprozessorVideo projectorNeuroinformatikArithmetic meanIP addressTerm (mathematics)Information securityInformationComputer animation
Game controllerNormal (geometry)Data conversionSerial portInternet der DingeBefehlsprozessorRevision controlWireless LANoutputPersonal identification number
Core dumpBefehlsprozessorWide area networkReduced instruction set computingFlash memoryReduced instruction set computingWireless LANLimit (category theory)Characteristic polynomialFlash memoryNormal (geometry)Multiplication signProcess (computing)Computer animation
Computer networkCharacteristic polynomialConstraint (mathematics)Digital libraryAnalogyData storage deviceSerial portInterface (computing)Computer programmingSerial portInternetworkingVoltmeteroutputData conversionPoint (geometry)AnalogyDigitizingTerm (mathematics)Semiconductor memoryPersonal identification numberCASE <Informatik>Bus (computing)Electronic visual displayBefehlsprozessorPower (physics)Internet der DingeSoftwareComputer animation
UsabilityRange (statistics)Food energyMobile WebAreaComputer networkInternetworkingFreewareWireless LANPower transformSpacetimeGraphics tabletUsabilityRange (statistics)Router (computing)Key (cryptography)Bit rateProcess (computing)Internet service providerGoodness of fitFlow separationSmartphoneConnected spaceData transmissionMetrePower (physics)Reading (process)Design by contractParallel portInternet der DingeSoftwarePerspective (visual)Wide area networkMobile WebPlastikkarteGSM-Software-Management AGAreaSimulationStreaming mediaComputer animation
Set (mathematics)Water vaporWireless LANTouch typingUltrasoundDistanceComputer animation
Computer programmingData modelFirmwareDefault (computer science)ModemEmulatorSerial portMaxima and minimaProgramming paradigmBefehlsprozessorCartesian coordinate systemCore dumpFirmwareComputer programPoint (geometry)BootingRadical (chemistry)ModemEmulatorRun-time systemSet (mathematics)Run time (program lifecycle phase)ExpressionComputer animation
FirmwareFirmwareRevision controlTouchscreenPresentation of a groupComputer animation
ImplementationSubsetNatural languageGame controllerLibrary (computing)Integrated development environmentCAN busComputer networkNeuroinformatikProjective planeAnalogyCalculationDigitizingNumberGraphical user interfaceInternetworkingEstimatorComputer programInternet der DingeWeb 2.0Stack (abstract data type)Web browserServer (computing)Process (computing)outputPeripheralComputer animation
ComputerComputer configurationInformationComputer networkMathematicsLine (geometry)Medical imagingControl flowPoint (geometry)Lattice (order)WhiteboardSineNormal (geometry)RepetitionAsynchronous Transfer ModeWide area networkAiry functionLatent heatRAIDElectronic mailing listBitAddress spaceParameter (computer programming)Online helpComputer programPoint (geometry)Presentation of a groupObject-oriented programmingSoftwareInterface (computing)Personal identification numberSource code
Java appletFirmwareEmoticonInterface (computing)Serial portService (economics)SoftwareCompilation albumFirmwareComputer programLaptopAsynchronous Transfer ModeCompilerInternetworkingCompilation albumData conversionPersonal identification numberBinary codeIntegrated development environmentWorkstation <Musikinstrument>Software developerRadical (chemistry)ESPRIT <Forschungsprogramm>SoftwareInteractive televisionGateway (telecommunications)DatabaseOpen setScripting languageComputer animation
Link (knot theory)Computing platformCompilerEmailAssembly languageLinker (computing)ChainPower (physics)Arithmetic meanCompilation albumLinker (computing)Process (computing)Service (economics)CompilerChainBefehlsprozessorArmComplete metric spaceNormal (geometry)Order (biology)EmailLibrary (computing)Software maintenancePower (physics)CodeLink (knot theory)Computer fileComputer programMathematicsComputing platformSet (mathematics)Router (computing)Integrated development environmentPoint (geometry)Software developerGNU CAssembly languageComputer animation
Core dumpArmModule (mathematics)Integrated development environmentFlash memoryCompilerDisintegrationJava appletProcess (computing)Computer hardwareRange (statistics)SoftwareUser interfaceMaxima and minimaMenu (computing)Open sourceChainGoodness of fitCoprocessoroutputWireless LANWeb 2.0Server (computing)Library (computing)Electronic visual displayIntegrated development environmentElectronic mailing listWhiteboardMagnetic stripe cardBus (computing)Data managementFile archiverComplete metric spaceSet (mathematics)Gcc <Compiler>ChainCartesian coordinate systemInternetworkingOpen sourceLinker (computing)Game controllerMusical ensembleComputer hardwareExtension (kinesiology)BefehlsprozessorMultiplication signAdditionBinary codeUniform resource locatorRight angleNormal (geometry)Computer programPresentation of a groupJava appletMereologyDistribution (mathematics)Doubling the cubeCore dumpModule (mathematics)Formal languageProcess (computing)Adaptive behaviorText editorWindowError messageArmCAN busCodeArrow of timeComputer animation
Computer programmingIntegrated development environmentChainBuildingInternet der DingeComputer programProgramming languageBefehlsprozessorCompilation albumSoftware maintenanceComputer animation
Computer programComputer virusNormal (geometry)Semiconductor memoryReduction of orderWireless LANWeb 2.0Open sourceScripting languageWeb browserFlash memoryRevision controlCartesian coordinate systemSoftware maintenanceCodePower (physics)Computer animation
Videoconferencing
Transcript: English(auto-generated)
OK, so welcome to this talk about IoT programming with OpenSUSE. My name is Klaus Kempf. I'm a senior product owner, currently working
for the Casp offering, the container as a service platform. But today, let's look at what is IoT. Why is IoT important to everyone? And since you are all hackers, I'd like to show you a couple of IoT devices
and especially how to program them with OpenSUSE. A bit about me. I'm meanwhile an SUSE and OpenSUSE veteran, 20 years already, active in open source for quite some time.
Google knows it all. Privately, I'm a father, a hacker, and a maker. I love agile and, as I said, taking care of containers. But IoT. So who knows what IoT is? Who has heard about IoT?
So OK, not everyone raised his hand. So IoT is the internet of things. That means that everything one day would get an IP address. Maybe these chairs will get an IP address.
Maybe the projector already has one. And they all communicate and interact. Why is it important? Because there's a lot of money behind. Simple as that.
And if everywhere there is some computer or device which has a CPU and some means of transferring information, it is also important to all of us in terms of security
and to understand what this actually means. So let me start with a couple of IoT device examples. Many of you know this.
That's actually not the latest version. The newer versions have wireless. But that's not what I'm going to talk about here. Because these things are pretty trivial in the sense of you
can put Linux on them and treat it as a normal Linux device. What I'm going to talk about is these things. And I have one here. So the little blue thing, which almost can't see.
This is an IoT device. The cables and the other thing is just a serial connector, a serial to USB. The IoT device is here. I have a couple of other examples. So for example, this one again here,
this is the actual CPU and wireless controller. And this is just a serial converter. This one is quite popular. As you can see, it has a lot of eye-opens.
And all these examples are dead cheap, a couple of euros. So what is inside? Usually, they are called ESP8266.
There is a successor that is called ESP32, which I don't have with me this time. They all do wireless, normal wireless. They have a RISC processor and very limited amount
of RAM and flash. But they are cheap. And for a specific purpose, they are wonderful. So what are typical characteristics of IoT devices, which I think are important? First of all, these devices are constrained.
You cannot run Linux on them. They are small in terms of memory. They are small in terms of CPU power. They have usually a handful, maybe two handful of pins
to interact with the outside world. Almost all of them run on low power, so not the typical USB 5 volt, but 3.3 volts. Some of them have analog input, so you
can have an analog to digital converter. Typical use cases for these are temperature sensors. Many of them have an I2C bus.
This is just a three wire bus for a lot of other things, sensors, displays, and so on. And all of them appear to your device as a serial port.
And of course, they all have networking capabilities so that they can interact with the internet. Let's look at networking, IoT networking.
This is the whole purpose of these things, that they can, via the internet, connect to the world or can be reached from the outside. Typical example, and I have a couple of devices with me, is, of course, wireless LAN.
It's simple. Everyone in the room here probably has a device which does wireless. The cost for these devices is small. Everyone has a router.
We have one, I think, here, which provides wireless in this room. So this is everywhere. And usage cost is also very, very low. So this is positive because here or at home, you usually have a flat rate and so on. Availability is also quite good.
I mean, everyone who has a smartphone, smartphones today depend on wireless. They don't work without wireless. So everyone who has a smartphone has a wireless endpoint to connect to. And there, an IoT device can connect to.
Range is limited, maybe 50 to 100 meter. Speed is quite good, usually. But power consumption is not so good. So running such a device on a battery doesn't last long.
They drain a lot of power. So you need, for wireless, you need a power outlet and a power transformer. Then there is BLE, that is Bluetooth Low Energy.
That is relatively new. I think it appeared a couple of years ago. Use of use is not as simple as wireless from my perspective. These IoT devices still cost more than wireless devices.
Usage cost is the same. I mean, if you have a Bluetooth endpoint to connect to, then it's simple. But they are not as available.
So for example, in this room, there is no Bluetooth endpoint to connect to. Range is also very limited, usually less than a meter. Speed is not so very good, but power consumption is really, really low.
So running these devices on a battery is easy. Then there is relatively new. This is GSM. So the mobile network to have IoT devices
which connect to the mobile network. Use of use, not so easy. Device cost is compared to the simple wireless devices, relatively high.
Usage cost is also high because you need a SIM card, you need a mobile contract, and you pay per megabyte. So you can't stream on these devices without paying a lot of money.
Availability is very good. I mean, mobile coverage worldwide is OK. Speed is also quite high, but power consumption, no. Again, those need a lot of power. And the last, and I think there is a talk about this
in parallel, is LoRaWAN, the Long Range Wide Area Network. That is something pretty new. Use of use is quite OK because, again, it's like the internet. Problem is device cost. Those devices are still relatively expensive,
and especially the endpoints are expensive. But the nice thing about LoRaWAN is LoRaWAN, especially in Europe here, is growing in the sense of
that people provide free endpoints. So usage cost is extremely low because you can connect to LoRaWAN endpoint, and from there, you have free traffic.
Availability is not very good, but it's getting better. I think here in Nuremberg, we currently have three or four endpoints. So I, for example, I'm active in the Nuremberg makerspace,
the Fab Lab Nuremberg, and we are currently in the process of establishing LoRaWAN endpoint and provide internet through this. Range is extremely good. Several kilometers, if there's especially line of sight.
Speed is very, very low, but that's the purpose. The purpose is not to transfer pictures, but the purpose here is to transport sensor readings, like temperature, humidity, movement or so,
and power consumption is very, very good. So I don't have one of these devices myself, but what I heard, you can run these devices for weeks on a battery because they don't have
a constant connection. They just turn on their transmission when needed. Okay, and all these internet of things, it is about sensors. This is what these devices are for,
and here is a typical example of, these are the sets you can get on eBay, for example, and for example, this one here is soil moisture. So you can check if your plants have enough water.
There is a Holz sensor touch. This is ultrasound for proximity. There are light sensors and so on,
and such a set costs, I think, 20 euros or so. Just to tinker with. So with a sensor and a simple wireless IoT,
you are in the 20, 30 euros range, but you need to program these things. So what do we have there? There is a very simple programming model, and this is kind of a very rough one,
but it should transport my point. So you have, of course, you have a CPU core. On top of this, you have a bootloader so that when the device starts, that it knows what to do.
And on top of this, you have the firmware. So to speak, the application, the base application, and then you have your application.
So this is the programming, the runtime environment, and this is your application. Usually, you can't change the bootloader, but what you can do is you can change the firmware. This is possible everywhere,
and then you can have different applications. So let's look at firmwares. If you buy these ESP things, then they typically are pre-programmed
with the expressive AT firmware. So an AT firmware does a modem emulation. So who of you is old enough that he knows about modems and the AT command set?
This is pretty old. These are the things that you connected to your landline. And I think it was Hayes, a manufacturer who standardized this command set.
So if you plug these devices in, they appear as a serial device, and what you need is a terminal program which talks to your serial device and opens through to the rescue.
There are even two of them. It is Minicom and Picocom. This is what OpenSUSE provides, and how it looks like is something like this. So you have every command starts with AT, and then, for example, AT plus GMR
shows you the version, and then you have AT plus CWLAP does a scan of available endpoints. And if you download the presentation,
you will probably see more of it, and then you will see this is an actual screenshot from the OpenSUSE summit in Nashville where I tried this out. But you can change the firmware,
and, for example, one very popular is MicroPython. Yes, you can put Python on these devices, and you have still room to write a Python program. And what this MicroPython provides is, of course, no graphical user interface
or something like that, but the things you need to program an IoT device. So you can do analog and digital IIO. You can do computations on these.
It has various buses to talk to external devices, and, of course, it has a TCP IP and an HTTP stack. So your IoT device can provide a web server endpoint,
and you can connect with your mobile phone or something like that with a browser to this device and read out your temperature or, I guess, gas sensor. So, for example, at the makerspace, so Fab Lab in Nuremberg,
there's a gas sensor for carbon dioxide, and based on this, there's another calculation how many people are in the room currently, which is pretty nice.
There is also another project on the Internet which does something similar, which scans mobile and wireless devices with such a small thing, and based on this,
estimates the number of people in the room. An example for MicroPython is this. So MicroPython even has a help command,
and then you can scan the network, and at this point, I'd actually like to demo it. So what I have here is a device like this, which is the same like this one. It just has more IO pins to connect to,
and it's a bit easier because I can connect a USB cable. So let's do the real thing.
So here's the Python prompt. I can enter help.
I hope this is readable for all of you, and here it even says how to connect to it. I can just now copy and paste from here. Import network.
Then I create a network interface and activate it, and then I can scan. Takes a while, and here it gives you
a typical Python list. Let's put it a bit more up. Okay, yeah, this is the simplest program.
So if you check on your mobile phones, this is the actual endpoints that are available in this room. So this is the name of the endpoint, and this is the MAC address, and a couple of more parameters like signal strength and so on.
Okay, I see at least two who don't believe me and check. All right, so back to the presentation.
Okay, yeah. That was MicroPython. Then there are a couple of other filmwares you can put on. For example, there is Espruino,
basically giving you a JavaScript environment. NodeMCU, Lua, also simple scripting. There's Basic and more. So if you Google for this, this is really amazing how much possibilities you have nowadays
to program and interact with these devices. Firmware update is also relatively simple. So either you have a device like this where you directly connect USB, or you get one of these USB to serial converters
and a couple of cables. You just now need to connect the right pins to put this device into programming mode. And then again, open SUSE to the rescue. There is Python ESP tool, and with Python USB tool and the correct firmware binary,
you can flash your own firmware. But no Linux. There is a couple of tools, but no Linux involved. So where is Linux and where is open SUSE? Well, all these devices need to talk to some endpoint,
and there Linux is everywhere. It is that Linux that holds the internet together that provides a database that runs on gateways and so on,
and that gives you a workstation or a laptop to program these devices. Also, you do your software development usually on Linux.
Then you do cross-compilation. You do debugging on Linux, and you have your terminal like Minicom. About cross-compilation, you cannot directly run Linux or your compiler on these devices.
So what is about cross-compilation? Cross-compilation means that it is not your usual software development workflow. Your usual workflow is you are sitting on the device, and you code, you edit, you compile,
you link run in the environment your final program runs. You don't have a change of platform. Cross-compilation means that you are developing in a different platform than the final program. So you need to compile for a different device. You need to link for a different device,
and at the end of the link, you need to upload it, and then you can run it on the final device. And here, OpenSUSE has a huge set of cross-toolchain tools. So, for example, there is cross-dcc.
That means a normal GNU C compiler, but it outputs code for, example, for one of these devices. And in order to do this, you need cross-headers, cross-in-clude files.
You need the complete bin-utils chain, like the assembler and the linker. And of course, in order to link, you also need cross-libraries. And all this is available on devil GCC in the build service.
Here, our GCC maintainer are doing an awesome job of keeping all these cross targets alive. So you get the latest and greatest GNU compiler, the complete toolchain, able to cross-compile for ARM.
AVR is the typical device for Arduino. You can cross-compile for power CPUs or a RISC-V.
MIPS, for example. MIPS is a typical CPU in a small wireless router. So, again, kudos to the GCC maintainers at this point.
Then, in order to develop, there's a very nice IDE, and that is called Arduino. So who has not heard about Arduino yet? Good. Thankfully, everyone has.
So a typical Arduino device would be this one. This, for example, has an AVR processor and also lots of IO. But no wireless. And newer devices of Arduino look more like this.
They have, meanwhile, an ARM core. Here, they have a newer Wi-Fi module. And this little thing here, this ugly-shaped or U-shaped
metal plate is the actual antenna for Wi-Fi. And with the Arduino IDE, you can directly, yeah, write your programs either in C-like language that is called processing or directly in C or C++.
Arduino IDE is, yeah, an integrated development environment. It's a Java, and it has some Go tooling. And there, you have everything.
You have a nice editor. Then it calls Arduino builder to call GCC and the linker. And it supports a myriad of hardware devices. How does it look like? So it typically looks like this.
So this is the editor window. You have a checkmark button here. This is the compile button. And then this little arrow right next to it, this means upload.
So you can then upload your compiled program. And here, coding is normal C program. What is extremely nice about the Arduino IDE is that it's easily extensible to other devices.
So just for reference in the presentation, for example, in the main settings, you can enter URLs of additional board managers so that it knows about new hardware, new devices,
new CPUs. Almost every device nowadays has such an extension. So every time you grab a device, you can add this here, and it's supported.
A quick look at what this means. If you download or add such a device, so for example, ESP8266. So the one here is called Extensa CPU.
And when you add this, you get a lot of additional binaries. And they all sound familiar. So you have the GCC compiler here, the archiver, runlib, gdb, ld, linker, g++,
the complete GNU toolchain. What is really amazing is the set of libraries, predefined libraries in IDE, in Arduino.
You have libraries for sensors. You have libraries for complete application, web servers. You have libraries for displays, for LED stripes. Here, just to pick an example, is a CAN controller.
CAN is a typical industrial bus to connect such devices. You can also update your libraries in this IDE.
It's extremely well integrated. And of course, you have a boards manager. And here is just a typical list of boards. And even if your board is not supported,
you can adapt everything. Arduino IDE is, of course, packaged in OpenSUSE. It's not part of the leap distribution. But we have cross-toolchain AVR, because AVR is the CPU where Arduino started with,
on-built OpenSUSE org. The package, for historical reasons, is spelled with an uppercase R, but the command is with a lowercase. I adapted it in a way that,
if you download Arduino from the internet, you get the complete GNU toolchain based on GCC 6 or 7. I adapted it in a way that, first, of course, this IDE is compiled from source, so it's not a repackaged binary. And I stripped all the Arduino-provided GNU toolchain,
and this uses the cross-toolchain from double GCC. Okay, I'm already at the end of the talk. So let's look at IoT programming with OpenSUSE.
It is extremely simple and extremely cheap for everyone to start with it. You have many, many sensors, and IoT is all about sensors. You can choose the programming language that you are most familiar with,
and OpenSUSE, everything is packaged and ready to use. And with that, I'm at the end. Thank you. Questions, please. And we have a microphone.
I will leave those ESP32 chips. They have Extensa CPUs, and we currently don't have Extensa cross-compilers, so I have to use the binary blobs that are provided for the Arduino IDE. Yeah, but that's probably just approaching the GCC maintainers
and enabling this in GCC. I was just pulling for the status. How far are we into this? I haven't looked at this. Okay, thank you. Because, I mean, these devices, I don't directly code in GCC.
I usually use MicroPython or JavaScript. Okay, I see. All right. Of course, if you want to, for example, compile MicroPython from source, then you would need it.
More questions? Okay, from the front. With the MicroPython, how do you upload the application? If you write a script or so, how would you upload it?
Yeah, you need to write a script and then wire a serial device. You can also enter it manually and then store it on the device. I mean, they all have flash memory. I can basically use this reduced-plane Python and program it on a normal NUC system, whatever.
Can some of the devices be updated over the air? Actually, all of these devices can be updated over the air
if you program it. So, for example, a German tool shop called Obie provided a wireless power plug, which you can, where you can wire wireless,
can turn power on and off. It costs 10 euros. It has an ESP8266. You can re-flash it with open source application.
This open source application then gives you a simple web endpoint. So you can connect to it with a browser. You can add sensors to it. And it has the capability to download new versions from the internet.
Nice. Okay. No more questions. So if somebody wants to have a look, I have some stuff here in front so that you can see how small these things are.
Otherwise, thanks a lot and enjoy your day.