 think some of you will have already seen some of this all over the camp. I actually have and I found them at EMF camp before and I think I missed some before this. It's a polycoins, it's a game and Michael Truller invented it as far as I know and he will tell you what it is, how it works and why he does it. Have fun! Hi, can someone do the slides? The main screen? It's the main screen is changing? Okay, brilliant. So hopefully you have, most of you have seen this but for the benefit of anybody who hasn't has a bit of an overview of what the game is. It's a fictional company called Polycoin that has this cryptocurrency. The idea is these are miners to generate that particular currency and you capture them for your team using an RFID card so when you first go to and visit one it will ask you to pick a team and once you've selected the team everyone you visit with that RFID card will change to your team colour. And the scores are based on the duration that you own it and your visits so if you visit one toward your team colour you get some bonus points. That's the basics of the game mechanics. It's four teams and you can pick from these evil corporations. So the idea originated because I played Ingress and then I went to EMF camp and thought well maybe I could do something interesting so I created this Orbs game and the Orbs game was far more simplistic it was literally a little ball it could beep and make flashy lights of only four well three colours plus white so it was quite limited in what it could do but the basic game concept was there and I deployed that in 2018 at EMF camp but the Orbs game was my first attempt at this sort of thing making custom PCB doing all those sort of things and it had a few problems. The cases fell apart they were held together with stickers that I made and yeah that didn't work so well. There was no monitoring of the batteries no kind of hardware monitoring at all it could have it had all sorts of problems with connectivity to the RFID reader and yeah I learned a lot from those. I also learned that ESP8266's can have random e-proms installed on them that aren't all the same and sometimes they only take about three flashes and then stop working so I stopped using them and switched to a slightly different model. So I wanted to make some improvements and I wanted to go full RGB LEDs so I could play around with lots of different team colours and really make sort of the full audio so it could speak to you really tell people what was going on because one of the challenges was with beeps you don't really know what it's telling you and also wanted that full-on battery management so it would monitor its own battery and be able to turn itself off and protect the battery which the other one couldn't do and I really wanted to do a better quality case because the other ones were falling apart so of course the Orbs game that's the original one and then I got this new toy 3D printer which is a dangerous thing to get and so I thought well maybe I could do something a bit more interesting so I created the new case and I wanted it to have the nautical feel because that was the theme EMF had for 2022 and the Polybius biotech underwater deep-sea research lab so I kind of went with a little bit more nautical look and didn't need stickers that was a really important one so I used a few tools I used Tinkercad to design it because again this was me learning how to do 3D I'm gonna progress something better but for now that was absolutely perfect for what I wanted to do I used Pira to slice it and then a Creality CR6SE to do the printing the case yeah lots of lines telling you what things are but the the main parts with this case were I wanted to click together so it didn't need screws and things to hold it together so you can see where the different that's actually yeah it's pretty easy to point so if you look around here you've got little retaining holes so you put the speaker in and then put little clips in to hold it in place so this is the back of it what happens is these pillars actually hold the PCB in place from the rear so it stops it falling out of its location and then around the edge you have these lugs locations which mates with the same sides over here to hold it in place and then the RFI the antenna is actually held here so it uses a full-sized antenna part of the reason for that is it just if you use the little traces on a campsite like this you're not going to get very much connectivity so I tried to make it have the best chance of good Wi-Fi signal it also has a couple of little bits as a hidden power button so if you look on the rear of them by the speaker you'll see a little round dots and that's actually this pillar here which connects onto the PCB and pushes a button on the PCB to turn the unit on when it's sealed there is no off button you have to actually open it up or use a use a special method to turn it off the up here you have the side illumination for the perspex so that's two neopixels that are just in a strip there and they get mounted up there and connected on and inside illuminate the perspex disc in the middle and the around the edge is where you have a neopixel strip that has 17 LEDs on it to do all of that colorful stuff around the edge one of the things that I learned from printing some other things was that you print a really nice big 20 24-hour print and you've got little clips on it that clip it onto something else which is great until they snap off and then you've got a reprint something that took over 20 hours so what I did was I instead put the put build these as two clips stuck together and then they clip into the holes on each side so that way if I prized them part and they snap I just need to reprint this tiny little lug that goes in between it also meant that whereas this is the main unit is printed sort of in layers that way this I can print in layers this way to give it strength along the along along the the stress line so that that really helped and I've got a bag of those just for when I snapped them as open the cases so this is kind of a an overview of the difference in the hardware so the original orbs game had so you just said it bleeped PWM and I switched to a DFR mini 0 to 0 2 9 9 mp3 player because that super cheap the memory cards cost more than the players now it's amazing bigger larger speaker flashy LEDs and the ESP 8285 which is the same as the 8266 but the e problems integrated into the expressive die so you know you're going to get good quality e-prom and pig micro processor which I upgraded between the two different versions this is the PCB from one side so up the top we've got the two connections to the different LED strips the mp3 player now up on the top right is two micro switches which are there to do the tamper detection now the tamper detection when triggered causes it to flash lots of lights make a siren sound and scream help me repeatedly which got very annoying for some people and the so on one occasion I was sat at the tea tent in the emf camp and my phone suddenly started beeping to tell me that a tamper detection trigger had gone off so I was like hmm which one oh the one over there and at the same moment I heard a siren going off so I kind of walked over to the hardware hacking tent and there's a person looking quite sheepish holding this coin making lots of noise where they've clearly just tried to prize the back of it so it did does work does work a few unfortunate incidents though because the tea tent actually blew over and that triggered the tamper detection as well and so yeah that was a bit unfortunate the accidental triggers but yeah you can see the power button just there which is where the that that kind of bit I pointed out on the previous slide touches so when you press the case in just there it turns it on the other bit is the charge socket which is a very simple usb-c power supply charger for lithium-ion cells and obviously you've got the three big battery connections around the edge the other side is has far more stuff going on so we've got a 3.3 volt power regulator this little bit here is unpopulated and the reason behind that is I learned that scale is really important when you're looking at the parts you're putting in if you're doing hand soldering so I suddenly discovered that the three that the power regulator had ordered was so small I could barely see it so I kind of but I wasn't sure I could get all the parts for a different version so I put both on the board just in case I had problems with part supply this incidentally was the third fourth power supply design I did because I couldn't source the parts for them so many times it's very frustrating but I think we all know that story you've got the the Wi-Fi module up there the PIC micro processor sitting over there and that's the kind of the brains of the operation that's that's what really does that runs the whole unit and then you've got the RFID reader so the the RFID reader it's a very cheap simple one these particular ones they come in a really bad state from China so the the two lugs you can see up the two inductors up here they totally under spec them so you get almost no reading ability in range so what I've done is I've replaced them on all of the ones that I get so I put ones with about about 200 milliamp capability at least and that makes them read from a fair distance and can read sort of more high-energy cards like payment cards and so on which out the box these can't do I also remove the LED from it because there's just waste power I don't know how much people know about RFID but the basics are when each RFID card has a UID which is a number between it's either four seven or ten digits long and is supposedly unique to that card they are not from the ones from China you can get lots of duplicates as I discovered but the the basics of the way this game works is it uses that UID to identify the player so it queries what that is retrieves it and and sends that off to the server for the for the game there's nothing actually read from the cards during the game particularly the game relies purely on that UID we don't write anything to the card to to kind of identify who the user is so yeah this this is the schematic of the board so I hope you can all read that perfectly from where you are so it's not intended to to to be looked at in detail I can provide that but this is the PIC microprocessor and that's as I said is the the brains the operation one of the things I wanted to do was was really manage the power in this because obviously these devices are sat around flashing LEDs doing all sorts of things for days on end and want to make sure the batteries aren't going to run out so so power management was probably one of my highest priorities when designing this so the reason there's a PIC processor as well as the ESP is because the PIC processor uses only a few milliamps when it's running and go into microamps when it's asleep so that means that I can turn everything off and use almost no power the ESP 8266 is then used for the communications Wi-Fi MQTT all of that kind of layer of comms rather than it being on all the time I can just turn it on when I actually need to communicate so one of the things that because the PIC processor is doing a lot of communication with a lot of devices I had to try and it's a pretty low-powered device I had to make sure that it could talk to lots of things simultaneously so what I did was I used hardware offloading on everything that I could so the PIC processor comes with hardware to hardware SPI interfaces to hardware you arts so the one you are talks to the MP3 player one you you are talks to the ESP Wi-Fi module the SPI talks to the RFID reader and the other SPI uses a thing called a configurable logic cell to generate the it combines the output of the SPI with a PWM and a timer to generate the native signal required for the LEDs so the WS2812's so that way I can literally drive all of the comms in hardware interrupt driven which means that the main program can just do its thing running sort of the game logic and not worry about any of the comms going on the yeah so the stuff it's coded in the ESP uses micro Python just because I'd use micro Python a lot and so I'd use Python a lot and micro Python just made it very easy rather than having to use a different language to run on the ESP module and I used something called proton PIC basic which was just something I started with many years ago and just carried on using for my PIC programming and it just made sense to do it that way so one of the challenges with micro Python if anybody's come across this is that because Python compiles when it runs it's very memory hungry if you're just trying to run code you can get about 100 lines and then it stops because it's run out of memory on the ESP range ESP8266 so what I do is I use a cross compiler so you can cross compile the the the the py files into MPY files and copy those up to the the ESP and that allows you to run a huge amount more I mean I've got many times that number of lines of code and it's running without running at a RAM so yeah if you if you do have a hit that challenge look at the cross compiler I've used actually split things into two modules so I have a module of functions that I kind of know work and are sitting alone and then have a module of the actual game sort of logic that on the micro Python side of things of course getting getting stuff onto the board is is really kind of important and what I've done before is I used headers pin headers but they're just a pain with load soldering so instead what I've used is pads on the PCB so it came printed with the pads and then I just use these to connect to it so if on the PCB itself there are two holes which are locator but like so you can see there's two kind of locator like sticking out on this 3d printed holder and that causes this to be located perfectly onto the PCB and then those Pogo pins touch onto the pads so that you can then you then get a good connection so the top ones wired up to do the ESP communication so that uses just connects on to a standard USB to serial adapter that I can then I can then cause to push the firmware and it has a jumper on it that I can switch between pushing firmware or pushing on or connecting to the repel and the bottom one is a connection to the picket 3 the picket 3 this is not an original one they do very cheap knockoffs these days and yeah it just allows me to program the pick chips very easily on the PCB the server runs these things it's runs on a little Raspberry Pi it uses Python as the the main code it stores all its data in a Maria DB I have my phone get notifications using push over if anybody's come across that it's a really really cool little tool it allows you to call a rest API and deliver notifications to your phone or to other people's phones if they set it up as appropriate so it really it's a really good way of keeping an eye on what's going on with the game so I get alerts if discs vanish offline when they come back online if a tamper is triggered and so on it runs on the main servers of Raspberry Pi and all the communication is via MQTT between the different components so all when the discs boot up they talk to the server via MQTT and query what their status is and what the current config is and that gets downloaded back to the back to the disk via MQTT and when you go up and present a token it will send that request via MQTT so kind of the sequence that when when somebody goes and presents a token is it turn it reads the RFID checks to see if it's not the current owner of that disk and then we'll send a turn on the Wi-Fi unit wait for Wi-Fi to connect an MQTT to connect and at that point it will send a query with this is a token I've just received and it then receives it a response back with this is a known player this is a team they're on or I don't know who this is so the the other thing is that because one of the challenges I had with with this was discs say losing communication especially the it will the orbs game things would lose comms and I wouldn't know so what I would do is with this is if they become uncapped they become uncaptured if it doesn't hear from the disk for a certain amount of time so the disk supposed to check in roughly every five minutes and if it doesn't hear for about 15 minutes then it will say this is offline I'm removing the owner and just stops discs that can't be played from just living on in the game and scoring points when no one can actually capture them the other thing is that obviously there's a bit of security I wanted to do we're at a hacker camp I kind of thought that maybe somebody would try and I'm pleased they have not seen any alerts whether they bypassed my alerts or not I don't know but the the way I've done the communications is when the when the discs start up at the Wi-Fi they actually query what the current time is so they'll do an NTP request to get the time and then every message they exchange includes the timestamp as they see it and they also include some known private known sort of bits of text that don't get transmitted but are included within the hash that it generates for the overall message and then it transmits the message with the hash which then means that the other end can verify that yes this actually originated from a disk so that happens in both directions so this when the server sends a message it's signing it and when the disk is sending a message it's signing it so that way they both know they're talking to each other and it's not easy to just fake a message or replay a message because the timestamps in there as well and if it strays by more than a minute or two then the system's going to reject it and again send me an alert that's happened so yeah there are some hidden features actually the hidden features there was an emf camp bonus so if anybody played emf camp your token ID was copied over and it checked to see if if you played before and it would have given you a nice little welcome and some bonus points if you reused a token between the two camps there's also something called command mode and this was something that kind of goes back to something I said which is it's really hard to load new config in in the original orbs game so if I needed to chain something it was so difficult so what I ended up doing was having a command mode they have a control token so this is a particular UID that it recognizes and when you present that it goes into command mode at that point you can issue various commands one is run diagnostics so I actually do some self-testing and report back if it's got any problems it also has features just turn it off so I can actually turn it off without triggering tamper detection then open the case up the probably the most important one though is the ability to push new config into the device so there's a data type called NDEF which if you've used RFIDs before and looked at it sometimes you'll see if you scan it they will say there's certain NDEF records there so I've basically taken a subset of NDEF and made it read the NDEF card to load the config in so I can present new config unfortunately at EMF camp I hadn't realized a little bit of a challenge there that the Wi-Fi had no pre-shared key and so my idea of loading new Wi-Fi config totally failed because I hadn't accounted for being as a load no pre-shared key at all so yeah that was that was awkward but the main thing is that I can I can present that and I can cause them to re-register so if the if whatever reason they they get upset with the server they lose lose comms and have different keys or anything like that I can reload the config and move straight on the other thing was payment card identification so there's this there's a file on on payment cards called to pay dot sis which when you read it it's an open file so you don't have to engage any form of real encryption to read it but all it does is it contains an identifier of these are the payment card processors available on this this this card so be visa or mastercard of the principle to what it will do is the get what the game does is it reads that and it also reads if there's a bit of text as well so you see with it so sometimes payment card providers include a few words so it will actually read that level of detail nothing more but it does do then prank the player so what it will do is it will it will it will wait until you're registered and then it will say authorizing visa debit card donation to Polycoin and yeah so that this does happen it's happened three times at this camp so far it doesn't always managed to get a clear read because it requires a lot of power and more time to actually read that file at EMF camp there was a bump into a guy and his little girl and we're talking about this and she had used her pocket money card on the on the reader and she had heard it say this and didn't hear the bit of the end where it goes just kidding so she thought that she donated something to Polycoin but I think it's a good good life lesson of where you put your your payment cards with a hacker camp for her so there's a scoreboard which this is the one at EMF camp and I'm sorry to say that the map on on the one that here is still EMF because I haven't got around to updating it yet so I will fix I will try and fix that before the end of the game if I can but the scoreboard it uses pi game to render and all it does is it sits on an MQTT feeder the scores just looking at what those are it draws an image of the map and then it plots the the different locations of the different disks wherever they they are located and gives you a running commentary of sort of who's winning what how well they're doing so a few problems at EMF camp one was that the other problem was so one was the PSK issue but the other problem was that the perspex disk wasn't held in so securely as it might otherwise have been and people were pushing against it a bit and that kind of caused things to fall apart so I had to change the design so I created this kind of ring halo thing that I pushed on behind the perspex and then had to secure with screws which I really didn't want to do I wanted to keep it all in in plastic but that was the way of stopping that from happening and causing it to fall apart but aside from that it seemed to go pretty smoothly mch however presented some new challenges I left them in my tent on Wednesday and the case is melted so some of the backs of the cases kind of look more like pop-a-doms than flat flat cases you know they it really wasn't good so there was some very kind people who actually helped melt the cases back into some form of shape for me and so this is the reason why some of them are a little bit kind of wonky it also meant that I had to totally turn off tamper detection so I had to reflash the firmware on all of them because the the the the tamper detection was being triggered because the bit where the the micro switch pushes against actually melted and fallen down in some of the cases so now it was suddenly triggering where it shouldn't so that was a challenge and I had had some very kind help with that kind of reassembly process so the other problem I've had is that the server keep steve holding to being turned off for some reason the case that I've got for my raspberry pi preferred to do that and it kept also losing it's the usb port some reboot so I'm gonna have to look into why it was doing that usb boot clearly has the odd issue a couple of special thanks yes then friend of mine created the node red website where the players register so I know absolutely nothing about that other than it connects or mqtt and he did all the work on that and firey fly for doing the fictional logos for the companies there are still some stickers for the companies if you back at the the polycoin HQ tent for anybody who wants them although I think we're out of polybius biotech ones now although I do have ones from the orbs game if anybody wants those so do we have any questions if you just want to go to microphone yes first thank you for the talk and as we don't have the internet sitting here we actually start with this microphone thank you for the game I didn't know what it was and I did open one of them up so yeah I was actually wondering because I don't think the temporary detection went off so it was off after reflashing still so there was at least a couple that went out before I turn the tamper detection off so you may have just found one of those yeah second question dsd card was somehow right protected I believe uh how did you do that because the sd card yes do not write to it this is the speech yes um a isn't weird okay thank you I want to write uh rictor where oh right it didn't work thanks hi uh cool stuff have you considered using that pn three five three two chipset because I know those that you use and they are absolutely horrible yeah so I guess there's a little bit of history with this when I did the orbs game I designed the uh I designed it around these because they were about a quarter of the price so and I didn't need any of the functionality of a higher spec board and so I just carried on that because all the libraries that I wrote for the orbs game I carried across into this game and it meant that I'd have to completely start from the ground up again and also I had a supply of these boards yeah that explains it also like esp 32 pyco has built-in flash and is only one chip it and can do low power modes and has multiple cores so radio and code don't interfere and yeah so I did look at the esp 32 uh the the challenge I had with that is I think the the low powered core is very low powered and couldn't do the things that I wanted it to do which meant that I'd need to run a higher power core I could be wrong but this was my assessment might might be and also you can run the clock down on the main course and so yeah I think it would be a challenge to achieve sort of a couple of milliamps um maybe yeah a lot of this again is down to where I had my code base and having to rewrite everything was something I was trying to avoid but at the same time adding the features in maybe there'll be a new version at some point that I'll kind of totally change everything but I just I would suggest using lora as the radio because the wi-fi is problematic so I have been looking at lora the biggest challenge there is the allowed on time so you're only allowed to transmit for a certain amount of time and that would be a problem for this game I think I might be able to do it but I have to really change the communication protocol and it might still be a bit over yeah that uh yeah that allowed on time is actually comes from the spectrum radio spectrum and wi-fi has the same problem or that it has more bandwidth yes okay thank you okay while there's another question coming up to the microphone I have a question do we have a scoreboard here somewhere yes it's at the polycore and hq which is between the bring and donate and the party stage and where do we find this hq it's a blue tent you can see a blue tent there that's where it is the the scoreboard at the moment unfortunately does still show the emf map so I need to update it and the color is wrong as well for polybius biotech again because it was blue at emf and it's orange here yes so the next question from the audience yeah on one of the first slides you talked about OTA update so do you have that already in or for which CPUs can you do it so the OTA updates works for the ESP8285 for micro python code that I've written so it won't update the micro python itself but it can download and update the the python scripts that are on there I haven't done the same for the pick chip because the flashing mechanism for that is horrendously complex to do actually on the chip so it's possible to do but that wasn't my focus at this at this stage it was what can I do quickly to get the actual product working and then then I'll look to do that in the future okay so you could update the game logic basically I can update certain elements of it but the pick chip carries a lot of the game logic how to respond to to certain presentation what if effectively it's the bit maintaining the state of the of the the crypto miner unit so it's it knows who owns it it knows which team it belongs to and so on whereas the wi-fi module is literally booted up each time it wants to communicate to to this game server okay thank you another question from my side at the em the emf there were these nice tokens that you also could buy and probably sponsor you where this is a little bit uh do you have some for mch are there some left can people get them yes they're still available they're again in the polycoin hq in a little box there are still some of the specific mch 2022 coins in there if you want a little memento one and the uh and the other ones that just got the polybius biotech logo on cool um if there another event where we can find the polycoins afterwards nothing scheduled i'll see how it goes okay so we have to be curious where to find it again and play it as much as possible at this camp because well we don't know when we see it again thank you there are no further questions from the audience um thank you microtono for making this game for telling us about the details and giving us the talk