 Welcome everyone to this virtual DEF CON workshop. I am Robert Nelson. I work for Digi-Key. Today we are going to be playing around with machine chat and the Nuculo F746 board has Ethernet and we are using the XNuculo IKS01A3 mem sensor. It's got a bunch of temperature sensors, pressure, humidity, and motion. So we're going to use a program for machine chat called Jedi 1. It comes in three products right now for the Raspberry Pi PC and Mac. We're going to use the PC version and we're going to basically run it on a little Linux desktop. For today, I'm actually using a premium because we're going to be doing a lot of sensors on the charts. So on the Linux server, I've already pre-downloaded this. So you get basically a zip file. We're going to unzip it and we are going to install and we are now going to start it too. So now on any computer in my network, I just have to access the IP address of the server at 9123 by default. Username is admin admin. I'm not going to save this and I'm going to agree to the license. On first startup, it wants you to enter a bunch of information for security. We're going to be a little generic. So this is the default portal. You got our dashboard, data view, system view. This will allow us to add charts with different data. System view allows us to create like a household. By default, we have the HTTP data collector enabled. We can write rules and then we can also do system monitoring. So for the moment, we're just going to pause on this application because we're going to go back to building the sensor device. And for reference, this is the board we're using. It has onboard Ethernet, which is really nice and we can use Arduino header and we're actually a program through this interface. The sensor board just plugs right in and it's got a ton of useful sensors. So the first part of this lab that we need is actually Arduino. So we're software download and you can just click the windows installer or Linux and we're going to start that install. I have pre-downloaded that just to make sure things would go well. So we're going to start the install to the default location. This will just take a moment. So we'll fast-forward. Okay, the install is finished. Let's close it. Now let's start Arduino. By default, Arduino only supports their own boards, which are the all arduinos. But with the help of a project from ST, called STM32 Arduino, we are going to add support to a big chunk of boards for so they have a link here that we need to add. So I'm going to copy and paste this. From Arduino we're going to go into the preferences. I like to enable a compilation upload messages. But right down here we have additional board manager URL. So we'll paste that click. Okay, I'm just going to move this over here. From the tools we're going to the board and then board manager. Now since we added the URL we can actually type STM32 here to get the installer for the STM32 cores and it supports a lot of devices. So we'll click install and this will just take a moment as this installs. We'll probably fast-forward. The installer is now finished. So we can close this. Now as a quick test, here we're going to blink an LED on the board. So this LED over here we're going to blink to make sure that Arduino only STM32 software is working. So all these examples are on our forum. So the first examples would be LED blink. We'll just copy this and paste it in. And we're going to have to save this. So we'll call it STM32 Lab and it's building. We'll switch over to the other views. You can see the board. We need to define the board. I'll click cancel. Tools. So the board when you do the STM32, this is a nuclear 144 family. And the actual board is the F46 and we want the COM port. COM port 3. So we'll do the upload button again. And from here on the bottom we can see we're actually building for the STM32 using the ARM compiler. So now it's finished. It's almost finished building. Now it's uploading through file system and it's actually blinking. We'll zoom in. So that's the LED we're toggling through that application. So let's move on to the next. We need to add a few libraries and these are all in the forum. There's actually four different libraries. STM32 Ethernet. That's what's going to make our Ethernet connector work. We're going to use HTTP client for sending data. We're using JSON for packaging and then we're going to add support to the shield board. So through Arduino we're going to add these. First one. Go to manage libraries. We need to add STM32 Ethernet. We're going to install it. And it's going to pop up that there's another dependency which we want to install that to. Next we're going to add the Arduino HTTP client. We're going to install it. Next we need Arduino JSON. We're going to install that one. Finally we need support for the shield. And this will bring all the different libraries for all the sensors on this board. So we're going to install them all. So we're going to move on to lab two. In this case we're just going to enable the Ethernet library and get an IP address. So the other thing we want to do is open the serial monitor and change just to 115 upon 200. And I'll go back to the forum and grab the source code. So here's lab one. The full source is here. Lab two. We're going to enable a WIP. That's your Ethernet. We're going to basically just bring up the Ethernet and grab an IP address. And the full lab is available here. So I'm just going to copy this with the raw version and just copy paste it. So here's our new application. We're going to still use the LEDs. The Ethernet is going to come up and we're going to print the local IP address. So let's build and upload this. And we'll bring the serial terminal to the front. There we go. We now have an IP address. So this device is just connected to the network. So moving on to lab three, we're actually going to control the status of this Ethernet port and show it on the LED by using the Ethernet link status option. So back to the demo pages on the forum. This will be lab three. So when the Ethernet is connected for like link status, we're going to turn the LED on and turn it off if it's unplugged. So we're going to grab this source and this is all on our eWiki machine chat under DevCon 2020. So let's grab the raw version and copy this over and paste it. So the big change is in this loop. We are now status off. So it's on, turn LED on, turn LED off. So let's build it. And as it flashes, we get the same IP address again, but we'll actually get a status of the link, whether it's on or off. So link is on. I'm going to move my hands and unplug it. And now the link is off. And this LED is now off. Plug it back in. The LED is back on. So for the rest of the application, we're going to use rolling transmit data and then the link is on. So I'll go back to the lab, which is now lab four. We are going to start reading the temperature data from the STT-S751 sensor. So go to the forum again. Down to lab four. So we're going to add the includes for the sensor. We're going to initialize iScore 2 bus. We're going to create a new device sensor. We only get temperature data in C, so it's converted to Fahrenheit, and we're going to serial print it. So let's grab this and we're going to build it. And so we're just going to print out the temperature in Fahrenheit. We're getting it from C from the device. Here's how we initialized it. And we're using iScore C bus. And there's our include. So right now we're not going to change anything on the ethernet side, but we're going to print out the temperature in my home office here. There we go. 77.8 around in this office right now. So let's add another sensor. So we're going to add the HTS-2031, which is a humidity and temperature sensor. It's very similar. We have a new include, new define. We're enabling the sensor. And like the other sensor, it only comes in C, so we're going to convert it. And then we're going to print both over the UART. So let's grab this lab. Just copy it over, paste it, and insert the build. So now we have the first temperature sensor, the second one, the humidity. So we're reading it here. Converting it from centigrade to Fahrenheit. And here's our new initialization for it. And the variable defines. There we go. So IP address. We have both temperature sensors. Now we have humidity. So we're going to add a third sensor for this, which adds pressure. So this is the next lab. That's the lab six. We're going to use the LPS-22HH, similar convention. We enable it. And we'll now have three different temperature readings, humidity and pressure. So let's grab the full lab source. And we'll copy it and paste it over. So here's our humidity and pressure from the new sensor. We're doing the read. Converting it from C to Fahrenheit. And how we initialize the sensor. And the structs in the include. So it's flashing it right now. So let's check out on the console. And now we have three temperatures. You've got humidity and we've got a pressure. So now we're going to convert this data into a JSON packet that we're going to later send to machine chat. So in the next lab, lab seven, we're going to generate a JSON data object. We're going to use this new include. We're adding a unique ID. This is so we can tell what this data is coming from, which device. So we have a target ID. We have the humidity, temperature, pressure, temperature and temperature. And we're passing the objects. And we're actually going to print it out as post data. So let's grab lab seven. So this is our JSON object we're creating. And we're just going to dump it to the serial port so you can see what it is. So let's build it. So we have our unique name for it. And our new include. Now it is uploaded. Let's check and see the data over the serial port. Here we go. So we'll just kind of pause this for right now. So here is our object. That's what we're going to transmit to the machine chat. And it's already formatted. We have our device ID, we have the data sections. So on the next lab, we're going to add the transmitter to the server. So this is lab eight. And so we're going to add the HTTP client. Our server is on this address for Jedi one. We're using the port 8100. We're going to initialize the library. And we're going to send it as an application JSON. We are a client. And we're going to send it. And then we'll read the response back to see. So we're just going to copy this or bring over to the application and paste it and bill it. So in here, we have our machine chat board, which is at server address 192.683.104. We're transmitting a report 8100. We have our library initialization. We got our post data. That's the variable we're going to use to transmit the data. We're creating our JSON object. We're going to use the client post to actually send the object and then read the response. So it is flashing now. If we take a look, we should get a response of 200 if the server is receiving the data correctly. If you get a 400 or 404, the server is not responding or the data is incorrect. And there we go. So let's disable all the scroll status code 200. So machine chat has successfully received the data. Okay, now that we have data transmitting to machine chat, let's take a look at some of the data in the server app. So bring up the application on Jedi one. And let's take care of look at the dashboard. So first, let's look at the data view. We're going to add some of our data points. We click add chart for right now. Let's just call this temperature and chart type just be a line graph. For source, we're going to use the SCM32F7IKS. And if you remember, that was actually defined right here at the top. So if you have multiple devices, you give it unique names, easy way to find the different data types. So for the property, we now have five available. We have all the temps for each device humidity and pressure. So let's take care of look at the STT temperature sensor. This is in Fahrenheit. And we're sending the data pretty quick. So we're just going to change just the one and click add. And now we have a graph. And it's been running for a while. One thing we could do is I can actually blow on this board. And there was a little bump, but we're not seeing a good, let's add a second graph so that you can see easier. So let's call temp and gauge. So chart type. I'll do a gauge minimum value of 70 to 85 source. We're going to look at that same STT temperature and units are in Fahrenheit. So change to the one. And we could actually move these graphs around too. So we can move you up to the top here. It's not what I want to do, but it's one of both. There we go. So 79 degrees for my finger on there. You should see a rise, unless that's not the sensor. Let's try this different spot. There we go. So now we're seeing a good rise on it. And so the only thing we could do is going to add more graphs. So let's take a look on speed, temp two, chart type. Let's do an area this time source is our board. And we're going to use the HTT S temperature. So another Fahrenheit, another one, look at it. And we're going to minimize so this study more room. So here's the second temperature graph. And we got the label on the sides. That makes it nice. Let's add another one. So let's be top three. Let's do data table. And we'll just add data sources. So property, let's do the other temperature, which I believe is this one, Fahrenheit. And then we can, so we got the HT, let's add LPS, another unit in Fahrenheit. And then we can add the other one. This is T, you can sort of Fahrenheit. Click add. Let's see the temperature. And I think this is time, but that's probably wrong. Oh, we have the labels. So this is here. And we'll call this one sensor. And then save. So there we go. Sensor name, temperature. I'm going to drag this over here. So the ones that we have left are humidity. And we can do this as a, let's do a gauge. Minimum value, 0, 100 source is humidity. This is a percentage. Change it to one. So there's our humidity. We're at 41.4%. The last we have the pressure. And then chart type. And let's do a title. I think these are HPA. So there's our this gauge. And based on certain conditions, we can do other things greater than we change the color. So let's say it's greater than 100 in the blink, and over 100 and save. And now that tile should be active. It's over 100. And say it's less than 100. I'm just going to disable this one. We don't need that one right now. Or above. So 1000. So now it's great. We can do different alerts there. You can add icons, default. So you can have a lot of fun with these dashboards. The other thing you do here is a system view. You can actually create, let's see, I don't have anything ready to go. Let's do a pressure gauge. So I can create a cool dashboard. It's called this. This will be humidity. Max value is 100%. And we can actually move and drag these around. And one of the things you can do on a background is actually draw a layout for your building or a control system. So it's really a nice way to do a quick monitoring system. And let's save it. So there's a lot of customizations you can do. And you can also create rules. So for example, we're in a low temp condition. Let's look at this. We want the assist temperature. If it's less than or equal to say, and then we just want a number of 50. And actions you can do, either notifications or plugin. We're going to save this right now. Because you can actually create rules. So there's a rule in our notifications. You can actually do email or SMS alerts by default. You can also run other applications. So it's a nice way to give yourself alerts if something is failing or you're monitoring. You can also create users for other things. So if you just want users to view the data. So we got these charts going. I'll put my finger over everything again. And you can see how these were sending data pretty quick. Basically once every second. So scene changes in real time. So this is pretty much it for the live demo. Feel free to give a Jedi chat a try on their tech forum. This link will stay up and I'll add more information about little things you can do. But thank you for taking your time. Join us on sddevcon virtual workshop. Thank you.