The upcoming talk is about the cardio badge two years of evolution. Please let's all for a second remember back 2019 the last camp that is what it looks like you were then it was dark there were some chimneys in the background there were lots of very shiny very beautiful lights and on your wrist your cardio your badge that's what what this talk is about your speakers schneider and ray Higgs will explain the new possibilities that came up in the previous two years for that badge schneider is working on has been working on most of the bachelors actually he's been working on the rocket the radio sdr one and also on the cardio and ray Higgs is a rust enthusiast and a cardio firmware hacker and with that enjoy that talk hello this is rahecks i'm schneider we're here to talk to you about the cardio badge let's start the adventure timer and see how long this is going to take us not everyone might be familiar with the cardio badge so we're going to quickly introduce it the cardio badge is the badge of the chaos communication camp 2019 it's a wrist mounted device packed with sensors featuring a micro python interpreter and bluetooth low energy it's able to take an ecg it has an accelerometer a air quality sensor and a bunch of other things the micro python interpreter makes it possible even for beginners to program it without writing a single line of embedded c code this was the goal of the cardio to get people to work with such embedded systems and provide a companion during camp to interact with you can see the picture where someone embroidered a led onto their wristband using conductive thread connecting to the side of the cardio where we have easily accessible contacts you can use micro python to interact with them get the led lighting for example when someone sends you a message producing the cardio badge was quite a challenge in itself the project failed dramatically almost multiple times if you're interested in such hardware products and how they come to be and let's say just half a year you can check out this thread on twitter it details everything from the design phase to the first prototypes to end quote mass production of the cardio badge right up until camp during camp a lot of things happened the firmware improved a lot people had a lot of fun and we're here to talk to you about what happened afterwards one of the notable things might be that we held some workouts in Berlin to get together and improve on the cardio or just help people out who want to work with them due to all the things you know happened in 2020 and 2021 this wasn't possible anymore so we held virtual workouts which is how we call the meetings which we are doing to work on the cardio you see a screenshot of our virtual meeting at RC free last year where someone was pointing their microscope at one of the sensors on the top of the cardio to have a look at what's actually going on in there before we go further into all the details of cardio a personal note if you own a cardio please get a case it's important to protect it and make sure that your display for example stays intact while you're wearing it and that you have a lot of fun over the coming years with your cardio it also makes it possible to more easily interact with it because the buttons are quite small and most cases provide better access to them there's more elaborate cases and there's easier cases to produce some of them are 3d printed some of them are laser cut if you own any of these machines a laser cutter or 3d printer do yourself a favor produce a case if you don't have one ask around we have a wiki page with different designs and the sources to them check them out and have fun with them like is now going to talk a little bit about the firmware the apps and other things which make the cardio actually do anything on cardio we have a dual core microcontroller we use this to have an operating system on core one which has the bluetooth stack and sensor services running the other core is entirely available to the user and by default it runs a micro python interpreter so you can easily write scripts in python but you can also write your own applications for this core in c or rust using the provided api between the two cores this is all documented in the firmware docs on the other side of bluetooth on the phone we have a companion app for android this app is available on fdroid using the provided qr code in the slide the companion app is used to access some of the features from cardio remotely for example you can set your personal state there or you can upload fires to the cardio's fire system or you can install apps apps come from the hatchery the hatchery that's in a repository from batch dot team for batch apps which supports cardio among other badges many cool apps were uploaded there during camp and afterwards so far we've counted 191 submissions for cardio there we want to show some of those here that's micro marble that's a game for cardio using the accelerometer we want to show this because it is written in python and it demonstrates how much you can do with cardio even as a beginner and it is written in python but it still runs a surprisingly smooth running on a microcontroller there's also a lot of other apps for example persistence of vision displays using the rgb leds on cardio there's a lot of apps using the sensors creatively for example xis a compass app or an altimeter and because cardio looks a lot like a smartwatch many people have been writing watch faces for it for example the control center but even though cardio looks a lot like a smartwatch that's not the only thing it can do it has a lot of sensors and you can do a lot more than just wear it on your wrist as a watch just as an example cardio would be just one step away from becoming your next bicycle taillight with an integrated brake light we now want to show some demonstrations of what you can do with cardio using some of the features which have been implemented after cam for example there is phyfox phyfox is an app from rwth achen which transforms a phone into a mobile laboratory you can use cardio sensors with phyfox over bluetooth low energy and this is what we want to demonstrate on cardio as noda said there is an environmental sensor the bme 680 the sensor provides some standard environmental values like temperature pressure humidity but it also provides measurements which can be used to infer an indoor air quality value and this is what we want to demonstrate to do this let's move over to the hardware lab we're now in the hardware lab to show how to use phyfox to read out some environmental data from cardio to do this we first need to prepare cardio a bit the first step is enabling bsec that's a library that is used to calculate the indoor air quality using the bme 680 sensor data to do this enter the bme 680 app and the app there is this message to press the top right button to enable bsec this will reset cardio and once it's booted again now bsec is enabled in the background and starts collecting sensor data next up we need to set up bluetooth enter the bluetooth app for that and turn on bluetooth because it is disabled by default cardio will reboot again now with bluetooth also enabled and now you need to enter the bluetooth app once more because this will then put cardio into pairing mode okay now on the phone you need to open the cardio companion and press the pair button and you should now see a list of cardios and select yours there and you can press the pair button and connect button now both devices will show a pair code confirm it on both ends and you should now have a successful pairing now you need to exit from the dialogue in the companion app and you need to restart the companion app once because there is still a bug that we need to fix and once you've done so you can press the connect button to connect to cardio okay with the successful connection we can now switch to five fox in five fox we want to add an experiment for cardio environmental data this can be done with the plus button and then pressing add experiment from qr code you need to scan a qr code which you will find on the cardio wiki this will automatically set up the experiment now then enter the experiment you can find it um another cardio section press the play button and now cardio will hopefully connect and you will see some sensor data roll in uh cardio will update the data roughly every three seconds so when you sample every three seconds and uh i should note that this runs in the background so um regardless of what cardio app is currently running so for example right now there should be the default watch running here it is um the b-side library runs in the background and also the bluetooth stack updates values in the background so in five fox um you can see a number of diagrams there is first three diagrams for temperature humidity and pressure i guess those are self explaining and then if you scroll down there's the indoor air quality measurements first there's an accuracy measurement then there's the iq itself um the accuracy will start at zero and you need to wait for it to reach either two or three um before the values make any sense um it will take some time because the sensor needs to calibrate itself first um and once the accuracy is up um you can see i aq values um they have a special meaning which we will show later and in the very bottom there is a co2 diagram this does not actually show co2 values but instead it shows it's called a an equivalent co2 value and this is essentially a guesstimate of um how much co2 could be in the air um from the values the sensor measured on this slide here you can now see what the indoor air quality values we just got from in five fox actually mean this table is from the pme 680 data sheet so you can see lower values are generally better and uh if the i aq goes too high the data sheet recommends that you should ventilate the room an important thing to note here is uh the initial values we get in five fox are bogus that's because psec needs some time to calibrate the sensor and only after this calibration is done we will get reasonable results you can see this in the i aq accuracy value you should wait for this value to reach either two for medium accuracy or three for high accuracy and only at that point uh the i aq values will make any sense the setup with five fox is one way to use this but of course you can also push the data elsewhere this is a screenshot of a graffana dashboard showing the same data in the background there is no red running and an influx db on a raspberry pi the idea here is to use cardio as a data logger and you could use this kind of setup for example to monitor the environmental parameters of a room back to five fox for a second this screenshot shows what's going on behind the scenes there there's this node based workflow on the left there's this bluetooth node where cardio sensor data comes in this sensor data then gets recalculated into the appropriate ranges for the diagrams and then gets moved into the graph nodes on the right to be shown in the experiment you could of course change this to do different kinds of experiments with different sensors from cardio with the data logger setup it looks very similar node red is also a node based workflow you can see on the right the graph that's used here the left nodes are for connecting to cardio and triggering readout of the characteristics then the samples get moved into this function node this the code for this node is on the left this just converts the samples into the appropriate format for the database and this is where the data goes next into this influx db from where graffana can then read out the values and show nice diagrams providing environmental data via bluetooth flow energy is directly baked into the cardio firmware if you want to write your own applications using bluetooth flow energy you have the option to use the micro python bluetooth api to do this in this segment we're going to show you how to write a simple application which controls a few external leds on an led strip using bluetooth flow energy the python code executed by the cardio is split in three sections the first one defines the service here you need to come up with some unique identifiers called uuid's you can look up the wiki page which is listed on the slide to figure out how to do that the second part is a function which gets called when a connection is made or a new packet comes in via bluetooth in this case we're just acting on bluetooth writes and forwarding the data to the rgb led strip which we connected via some crocodile glimpse the third section simply turns on bluetooth and then spin loops in an endless loop waiting for a connection and data to come in usually would now put this file onto the cardio's file system navigate to it using the menu and execute it but that's not a very convenient way to develop new applications instead we want to introduce you to the pie cardio tool which allows you to directly execute python files via usb you call it using pie cardio dot pie and the file name you want to execute hit enter and now you can observe it loaded the data onto the cardio's ram and started executing the file it also outputs the log data on the same terminal as you can see it's now the print with waiting for connection is shown to send data to this device we've devised a little python script on the host which connects to the cardio and sends some rgb led values rgb values i'm sorry once you execute this it starts to connect to the cardio which takes a few seconds and then in rapid fashion sends a few rgb values to it now you can extend the script as much as you want if you want to have a flash once you get a new email or maybe if someone messaged you no problem if you disconnect from the cardio or from usb you can see that the leds continue lighting the cardio is running on its battery and the data comes in via bluetooth you can find the files to do this in our wiki as well as our repository if you're looking for a more elaborate example of this functionality we've recently been experimenting with apple devices as they provide native bluetooth low energy functionality to companion devices like the cardio badge they offer the functionality to receive notifications for incoming messages if the bluetooth low energy device subscribes to them via bluetooth low energy you can see a demo of this right now where a modified g watch registers with this service of an apple device and receives a notification when a new email comes in this is not yet published but we intend to publish a modified g watch on the hatchery sometime next year so you can make use of the cardio and this notification functionality from your apple device note that there's no additional software or app needed to do this the apple device already provides this another thing you can do with ble is hit devices human interface devices cardio has support for these and there's a hit demo included in the new firmware for example you can use this human interface device to emulate a mouse in this case using the accelerometer which means if you tilt cardio the mouse gets moved we've connected this to the android phone here and as you can see the mouse cursor can be moved using cardio now so let's use this to change the personal state of cardio in the companion app using cardio of course a mouse is not the only device that can be emulated for example you can emulate a keyboard which means you can press key or do key presses which you can then send to a connected host so for example in the hit demo you can set or send volume up and volume down key presses but this entire interface is accessible to micro python so you can very easily use this for whatever applications you fancy of course one of the main features of the cardio is to take an ecg to do so you can simply start the ecg app mount the cardio to your wrist and press with a finger on one of the exposed contacts after some time this signal will stabilize and show your heartbeat this takes a few seconds due to the involved circuitry but eventually you'll get a signal like that where you can easily make out your heartbeat at the moment it's around 90 bpm i think rx is a little bit nervous we've recently introduced the feature to receive this data via bluetooth low energy as well we're making use of this in our latest release of the cardio companion and if you open the cardio companion now while having the ecg app running on the cardio you'll get a new button to take an ecg let's press this and as you can see the ecg data that you see on the display is now also streamed to the phone we're going to work on sharing this data or make it possible to share this data and save it to files via your phone and also have the option to run an ecg continuously in the background to make use of this feature you might want to think about soldering one of these it's a cable which adapts the usb c connection of the cardio to standard ecg connections that for pads that you can buy about everywhere if that's not fancy enough for you you can also think about getting a chest strap which wraps around your chest and has conductive pads on the side this makes it possible to wear the cardio for example while running and take a full ecg while doing so we've also created an application which runs on a pc it's written in python which also connects via bluetooth low energy collects the data and applies a few basic filters it adds a 50 hertz noise filter to filter out noise coming from the grid and also creates a fft to get an idea of the frequency components of your heartbeat after all these demos let's head back to the main room to highlight some of the other things which happened during the last two years in the world of cardio a lot has happened since camp as you saw just now but of course that's not all we want to show a few more things first of all the battery lifetime is much better now with the new default watch face g watch you can get up to two days with ble disabled or about one and a half days with ble enabled of battery lifetime on the slide you can see some code you can add optimization to your own apps by adding this time dot sleep call this is what the firmware uses as a hint that your application is now not busy and it then scales down clocks and does similar things to reduce battery consumption another thing that was improved a lot is ble we worked a lot on making ble more reliable and especially getting it to work reliably with newer generation bluetooth devices we also added some security so if you remember during camp we had a lot of people randomly dropping files onto other people's cardios this is no longer possible or at least not as easily because now there's this numeric comparison code which you need to accept on cardio before someone gets a successful pairing and as we've shown you can now implement your own services your own ble services from micro python which also allows a lot more um ble stuff we also implemented automatic time synchronization when cardio gets a ble connection it will now automatically synchronize time with the connected device it does this using a standardized service called the current time service this is implemented by default on ios so when pairing to an ios device this will just work on android this is not implemented by default but the cardio companion app implements it so if you have that installed and running it should work just as well importantly this does not only synchronize time but also the time zone so wherever you are you should now immediately get the correct time on your batch another thing another few things that happened usb storage mode you no longer need to go to the boot loader to get into usb storage mode to load files onto cardio you can do this directly from the firmware now there is a new menu point called usb storage we added rtc um support so deep sleep rtc support which means that um the rtc time is kept during off time for the cardio a much requested feature that we added is image splitting which means uh and a png loader you can now put a png file onto cardio's file system and easily display it on the display from micro python one thing i want to highlight that's been happening very recently is integration of a vector graphics renderer this is ctx ctx is a is a vector rasterizer written by pipin which is specifically also optimized for user micro controllers he helped us integrate it into the cardio firmware and um this means with the latest release you now get anti aliased fonts for now this is only implemented in the graphics backend which means um it just improves the render quality of the existing graphics api but in the future we also want to give direct access to ctx to user code which means you can do all kinds of crazy vector graphics effects on cardio now there are some other things we want to do in the future and schneider will tell you about them there's certainly many options on where to improve the cardio one of them is the ios app during camp a beta version of an ios companion app for the cardio was devised there was a test flight version for beta testing sadly it never made it into the ios app store if you are a apple developer and you're interested in the cardio please get in touch with us so we can get the cardio companion for ios into the app store it will allow a whole new set of users to experience the cardio in all its features specifically this also means installing applications from the hatchery at the moment people who use ios devices have to mount the cardio in via usb and drag over some files manually onto the file system that works no problem but a nicer user experience obviously is what android users have with their cardio companion where they can scroll through the apps and just directly download them through a bld connection ix and i don't have apple developer accounts that's why it never happened but please get in touch with us so we can do that the other big thing we want to improve is ecg as you've seen we've implemented streaming of ecg data via bld and we want to build upon that the cardio companion is about to receive at least the ability to save the ecg data and share it directly from the app there's some research out there which looks at how to make use of ecg data for example to improve meditation skills or look at how bio rhythms of people synchronize when they interact with each other this should be much easier now with ecg streaming via bld enabled if you're an android developer and you know your way around kotlin it should be an easy start to do some basic analysis on ecg data there's also quite a bit to do on improving the documentation of ecg setups how to use the wrist straps how to use oh sorry how to use chest straps how to connect them what kind of options to choose in the ecg menu of the ecg application this will be one of our main focuses to improve cardio this concludes our talk right here it took us around 31 hours 43 minutes and 55 seconds to do so at least that's what the adventure time on my cardio tells me if you want to get in touch with us you can have a look at our documentation on our wiki the url is there it gives you links to our git repository our firmware documentation user guide and similar you can join us in the cardio batch channel on the bera chat as well as our matrix and two channels our bridge to each other so you can use whatever suits you best or if you're into that thing go to twitter or cars dot social and have a look at our handles there with this it's now time to go to the q and a stage and get in touch with you so it gets thank you very much for the awesome talk people if you would like to add questions please put them to twitter master dawn or the irc network and we actually get our first question is there a nice reusable ecg sensor option the salt set is not very good for daily use that's an excellent question we i i tried to touch on that when we rounded up and i showed the wrist strap sorry chest strap i have one on me right now i won't pull out my shirt but you can get these for commercial ecg sensors they wrap around your wrist and you can undo them and there's an easy way to adapt these ecg leads that you can add to the usb c jacket of the of the cardio we are working on some instructions on that inside the wiki but that's the most convenient way it should also work for example for running it's in what will we see as a badge for the next camp no excellent question um so you might remember the radio badge and the cardio badge they have something in common they feature a very specific sensor or functionality and that was out of availability and personal interest and similar and to give people the option to play with these things but if there is going to be another badge for camp 2023 42 years of ccc it should be about interaction of people it should mainly focus on social aspects and interaction with the camp i think we'll have a discussion about that early next year thank you so not a specific very uh like not every feature and not that one specific sensor but more focusing on people and getting people to talk to each other and have very low key options of getting in touch and interacting with each other right thanks and is there by any chance an option left to get a cardio badge yes actually we have great news that we can share um one of the hardware distributors uh who sponsored the cardio badge um is working on re-spinning the design files as a reference design for one of the chips and that's maximum slash analog devices now um it's still in the works we have no clue about the timescale but um they're working on it it's in the SAP system and it has a designator so looks uh promising that it's actually going to happen okay where should people watch out for this to get updates the twitter account and our car social account hikes would you mind going to the bme 680 style yes we did update the slides after the first random there's one important point about the bme 680 we were talking about it measuring air quality and we want to very make it very clear it is measuring volatile organic compounds in the air essentially things you could smell it does not measure co2 directly but it infers it assumes okay if there's lots of smell in there that's assumed it's all from humans how much co2 would they probably have put into the room as well and that's what the co2 measurement here is about because we have questions about co2 measurements and what they actually mean all right thank you thanks and um you're probably gonna love about that one but is there still a chance to get a radio badge there are very few still available i think maybe like 10 maybe so if you approach us with a good idea of what you want to do with it a project just have to convince us that you know should get one then you'll get one well good excuse to get into sdr hacking um at least it's fun yeah all right um for that thanks again for the awesome talks thanks for the patience and answering the questions and thank you thank you for making the cardio badge thank you we also want to thank our video angels who helped us produce the video we want to thank all the cardio team we are just two people of a large team who made the cardio possible and it wouldn't be without them you can have a look at the camp talk to see most of them all right then there was our last talk for today at least two of the other stages are still broadcasting as a live stream if you would like to continue watching otherwise see you tomorrow and please provide feedback on that talk and all the other talks we had today that is really helping the speakers and feedback is something you miss if you just talk to your camera so be a nice person be in a be be a nice life form and just do that and with that see you tomorrow that's party bye