 Yeah, thanks for coming to our talk. So basically what we did we reverse engineered the hardware of the hoverboards you probably all know like these annoying things driving around and we wrote our own firmware for these so we can use the motors and everything for our own projects and We would like to give you a brief overview of how we did this so you can get your own moving object moving We will split the talk in two parts first of all I will explain you like the basics how you get the firmware on the main board and Later in the second part young Henrik will show you how to build your moving objects and practical advice and so on So how this all started was with hoverboards being the Christmas gift ever 2014 maybe you can remember like my sister also got one everyone wanted them and yeah It was like quite a big thing. However, they are not so well engineered. So two years later These things started showing up on eBay and eBay Klein and saying you can get them for 50 euros Currently you can get them even for 10 euros So it's a quite cheap hardware and as with every cheap hardware people are starting to get them to start to hack them and The first thing people did on Hackaday was to trying to reverse engineer the internal serial protocol The hoverboard uses for internal communication So there were some projects that were able to control the motors with Arduino. However, it was still the original software running on the boards About 2017 there was kind of the leak of the original Chinese source code on the hoverboards and we use that to like Take about a firmware and to write our own control functions to use this firmware With the mainboards. However, this doesn't work so well because like it's a patchwork of old software new software So in 2018 we started to build a new firmware completed from scratch we reverse engineered the schematics of the hoverboard and Yeah, did everything from scratch with an hour more clean firmware so Yeah, here we have a look of to the inside of typical hoverboard You can see The battery on the left. It's a quite big battery for such a device for consumer device Yeah, and Henrik will talk about this battery later We have two sensor boards on each side of the hoverboard These are these are the units that measure the angle to Regulate the position and the angle of the hoverboard these communicate via you out with the mainboard which is here This mainboard contains the actual controller the MOSFETs for the BLDC controllers And we of course have the motors which are 350 watts by spec with Hall sensors and these go up to 40 kilometers per hour and 800 watts Before they start burning This is what such a motor looks like from the inside you can see like the copper coils the permanent magnets on the outside Here are the Hall sensors and as I explained earlier you can get these Motors for about 10 euros. So these these hoverboards are completely broken like the battery is flat and the electronics is ripped apart So it's only the motors, but it's still 10 euros for two motors. So five euros per motor, which is excellent for such a nice motor Now you have these motors and you have to control them. Unfortunately, you can't just apply voltage and they start spinning because these are Synchronous motors, so you need a controller for them I picked a free typical motor controllers You may already know the feather is C auto control and the original hoverboard hardware The feather you see is engineered quite nice. It's open source hardware has lots of currents and lots of interfaces However, it's quite expensive. It costs about 120 euros Maybe less if you assemble it yourself and it's only for a single motor So if you want to build and moving armchairs, so you need two of them, which is also quite expensive Auto control is basically the feather is C but cause optimized It has a bit less current but also lots of interfaces. However, it's still quite expensive because you'll also need two of these Which is about 100 years, which is quite a lot for 10 euros motors. So What you actually want to use is the original hoverboard hardware because it already Contains two BODC controllers. Also, it's not cheap. You can get these PCBs new from eBay or AliExpress. Unfortunately, it's proprietary Chinese hardware and you don't really have interfaces You have to hack them to get data in and out of this mainboard and it's also quite large compared to the other To the other controllers, which might be a problem if you want to build a small moving object Yeah, so I said you can get these these boards together with the sensor boards on AliExpress for example for like Very cheap. Other sources may include Amazon, eBay, Alibaba, you can get them everywhere It's really easy to get them. This is what such a typical mainboard looks like The main part is the STM32 It's an ARM processor which does all the controlling of the MOSFETs and Yeah, the hoverboard There's a discreet DC to DC converter in the middle which Converts the 40 volt battery voltage down to a more usable voltage of 15 volts which is for example used by the gate drivers This voltage is then regulated down further to 5 volts and 3.3 volts by linear regulators for the STM32 and the Hall sensors Here you can see the six MOSFETs per side which are used for the half bridges to control the three phases of the motor These may vary. These are the parts found in our mainboards But like the Chinese solder in whatever they find found on the local market So these vary a lot. They may also vary in one mainboard so you can find different MOSFET types in one assembly Yeah, what else? These are the gate drivers. These are fully discreet Which is quite nice because if one blows you can simply replace it by fixing the individual transistors that might be a broken We have a piezo buzzer, which is very important Yeah, we have we have two ways of measuring the current in the motor on each side of Each its motor has a DC current shunt to measure the current flowing into or from the battery and we also have a current sensing wire To low side MOSFETs wire op-amps that amplify the very low signal of the RDS on current sensing of the low side MOSFET We have also quite some connectors on there. First of all is the power connector or the power button connector Which is used to switch on and off the mainboard Then we have the XC6 the main power connector, which connects to the battery We have the main motor wires which go to the left and right motor, of course We have a charging connector to charge to plug in the charging Jack to yeah charge the battery We have a programming interface which is very interesting for you because this can be used to flash our own firmware to the SM32 We have the left hall cable hall sensor cable for the motor you can get like five volts With 100 milli amps max out of this if you want to add a display or whatever Yeah, the right hall sensor cable and the most interesting thing for us The cables that originally connect to the two sensor boards that we don't need now anymore Because these are the ports are we mainly used to interface the mainboard on the left side We have two ADC channels that can be used to measure analog values Also, these can be used for you art and on the right We have also you are interface which also can be used for ice cretsy Which is very nice because you can connect for example a renun shock Which also uses ice cretsy to interface with the mainboard the software is going to get up and You can simply clone there clone it to get like basic operation of your moving object All you really need is the config.h file in here are different configurations First of all you can configure a user debug interface, which can be used to get values For debugging out of your mainboard you can choose whether to use user 2 or user 3 Either if you want to use the left or the right user port can also set a board rate Then you can configure what you want to use to control Your moving object as I said before you can connect for example Potentiometers as an analog value you can connect a Nintendo nun shock or you can use a Common RC remote receiver which gives out a PPM some signal to control the driving behavior There are three variables or defined variables first is the filter. This is like a moving average filter This is you that is used to filter the Controls you give in there. You usually don't need this filter But if you have for example analog potentiometers, you may want to filter the values in software to get like a smooth driving behavior And there's also speed coefficient, which is basically a multiplier for like the throttle and you get Steer coefficient, which is basically Determines how much you are moving objects years if you move left or right you can see example conflicts for example for our bobby car At our bobby car. We don't have software steering because we have like a hardware Steering wheel. That's why we don't need a speed coefficient. Also the motors are mounted so that they need to Spin in the wrong direction, which is why we use a negative speed coefficient So this is the point where we where you want to like modify things to get your moving object moving as you want Independently of how you configure all these things What matters in the end are for global variables, which are PVML, PVMR, weak L and weak R To get a better understanding of what these variables do We first need to take a closer look on how motor controllers work in theory. On the right you can see a Simplified illustration of what a BLDC motor looks like in the middle You can see the permanent magnet rotating clockwise and the two field Wectors Q and D which are generated by the motor controller, which are also rotating synchronously to the motor the Q vector is perpendicular to the magnetic field of the permanent magnet and Those creates the actual throttle together by the understanding of what this looks like here's a Better animation You can see the field of the permanent magnet and the motor controller Rotating the Q field correspondingly using the Hall sensors as position information This is done in software quite easily by using the plug WM function Which takes the position which is calculated by the state of the Hall sensor and outputs free variables u v and w Which are the PVM values for the corresponding phase of the motor these functions also take the PWL and PWR Variables which are basically the length of the Rector These range from minus one thousand to plus one thousand and Correspond to a torque of the motor from minus one hundred percent to plus one hundred percent So if you set these variables your motor will start spinning at a given throttle at a given talk This is actually all you need for most basic moving objects So what about these other two variables well the thing with BLDC motors is that these are like copper coils and the coils that the thing with Inductors is that their electrical resistance increases as the frequency increase so as you speed up the motor the inductance will increase as well and And the DC resistance will increase as well And those there's a point at a given voltage where you can't reach higher speeds without modifying Something else for a typical hoverboard setup. This is the case for a speed of about 20 kilometers per hour Which is already quite fast, but you can go faster with a trick called field weakening or phase advance. That's where This other vector is interesting because it's in parallel with the magnetic field of the permanent magnet We can apply a second magnetic vector that is in reverse direction of the permanent magnet field And those weeks this permanent magnet field by weakening the magnetic flux of the permanent magnet We can lower the inductance of the motor and those get higher currents into the motor at a given voltage This looks and software quite similar as before. However, now we don't take the position left or position right Variables, but we take the position position left plus one variable Because in our motor unfortunately, we don't have position information for a 90 degree vector because we only have Six position points per per pole So we take the next closer to 90 degrees which is 60 degrees to generate a second field vector Which then sums up together with the q vector to generate the resulting vector Which is a bit advanced to the actual vector We would use to normally operate the motor. That's why this a procedure is called phase advance or field weakening because it weakens oops it weakens this vector This can be used to get your moving object Moving even faster this variable reaches from This variable reaches from oops from from zero to one thousand And yeah can be used to get like an additional speed boost But this looks like can be seen in This video. Here's our Bobby car We use like this additional code in the main C function to get some weak Some somewhere some value in this weak variables if the button for the turbo boost is pressed and there's already a given speed Which is close to full speed and yeah, this looks like this And this would on the road this would result in a speed of about 30 kilometers per hour and Yeah, just that you know what these weak L and weak variables do Yeah, you can have a closer look at the code in the description on github if you want to know more about them Yeah, that's how to configure all the software if you are Happy with your configuration You can build the software if you have all the tool chains set up correctly You should be able to simply type type and make to get like the binary file And this binary file has to be flashed to the STM32 on the mainboard for this you need an ST link for to which is a programmer for this chip You can get them for two euros on Aliexpress or eBay or whatever or you're on the VPN if you ask kindly You have to connect the SVD interface Accordingly to the pinout I showed earlier or by this picture Second yeah exactly second you need a power source to power the mainboard Which can be for example the original battery that is charged. It shouldn't be too empty And another important thing you need to bridge the power button because there's a latch circuitry Which is held up by the STM32 and if you reset the STM32 during programming You may power off the power of the STM32 you're trying to program So it would kill itself and may break the firmware So you need to make sure to either permanently press the power button or to simply jump at it Yeah, then you can unlock the flash of the STM32 using make unlock and then you can flash it using make flash After this the firmware is on the mainboard and you can try to Debug things if it doesn't work out of the box for this as I said earlier you have a user connection You can configure this in the config file You can connect USB to user converter to one of the sideboard connectors and Then there is the set scope Set scope channel function which can be called with a channel and the variable you want to plot and then this is locked to the console either in ASCII by comma separated ASCII or If you want to plot these variables There's also a GUI called servo term which can be used to plot things if you want to have like a continuous view of these variables Also, there was a fork recently on our Github repository by Tom tinkering. I would like to announce He built an additional function in our firmware to interact with a GUI He wrote and this can be used to Tune variables in real time and to plot these three variables as well I didn't try this myself, but it looks quite promising So if you need more debugging than plotting variables, you may give this a try the link is here Yeah, now the firmware is on our boards and the motors are spinning now You need to build your moving object and for this young Henry can give you some advice And to get you moving objects on the road we first of all need a mobile power source lithium-ion or lithium-polymer battery is the most fitting choice there and The most common battery yet that you may encounter will be the original hoverboard battery as it's very cheap and quite good It contains it is a 10 s2p. That means 10 sides in series to imperial lithium-ion battery That sums up to round about 42 volts at 4,400 milliampere hours If you want to go faster therefore need a higher voltage or you just want to have a bigger battery more power Then you can also use some low-cost lithium-ion or polymer batteries for example about from hobby king the highest voltage that the Mainboards can handle is around about 55 volts which sums up to 13 s battery and the biggest battery that we have Used by now is an 16 ampere hour battery at 12 s which sums up to round about six cells in parallel The one of the features of the original hoverboard batteries is that they have protection internal This looks like such a Balancer and It features an overcurrent over temperature and under voltage protection for these cells Which is quite handy if you buy some lithium-polymer cells They usually don't have that but you can build one yourselves from a cheap balancer board from eBay and some XC 60 connectors and we did that there with For two six s 6p batteries, so we can have a 12 s 6p battery pack for our Bobby car Next you have to tell the moving objects where to go to do so we have quite a few options First of all, we have an we have two analog inputs which range from 0 to 3.3 volts Also, we can have an ice-crusty input which can be used by a Nintendo Wii nunchuck Which is quite handy and also you have a timer input which for example can be used for PPM Also, we have two UART inputs or two UART interfaces, but we haven't written any film there yet for that so You can use them, but you will have to write something there yourself To make things easy we created a PCB Which features and JST connector where you can directly plug the hoverboard in Next to that there are some ice-crusty pull-ups Some ADC pull-downs these are quite useful because when you connect for example a potential meter to your main board and A cable gets loose The the ADC input pin might might be floating which is not so cool if you are sitting on a Bobby car So you might want to use some pull-downs So the speed goes down to zero when a cable breaks rips off something happens. What shouldn't happen? Next to that Otter we have a UART header which allows you to quickly connect to UART via pin headers and One of the very handy features is you can directly plug a nunchuck into that PCB It fits very well and snaps directly in so you can directly connect a nunchuck to your main board without having without dealing with cabling and soldering As in nunchuck and the ADC needs 3.3 volt or the ADC has a maximum range of 0 to 3.3 volts and the main board only outputs 15 volts You we also need a LDO or a step down as everywhere you can solder in an LDO there A 3.3 volt is the most common choice, but 5 volts are also possible and We also have a small ADC interconnect matrix or jump as air which allows us to connect a second Hoverboard mainboard to this PCB and therefore allows us to drive two mainboards independent Next to each other for example for our Bobby cars. We have a all-wheel drive And so we need the potential meter go to both mainboards With this you can directly plug two mainboards in configure them. We are the Interconnect jumpers and have the ADC signals on two mainboards This also allows you to have a cross over for you out so the two mainboards can communicate with each other But again, we haven't written anything there for that yet And one of the applications we have built the most recent one which you can see here is our Bobby car or Bobby cars They are teaching a 12 s and a 13 s lithium-ion battery. Therefore one of them has 50.4 volt battery the other one has a 54.6 volt battery They're teaching an all-wheel drive which Yeah Yeah, yeah, and which Means that they have a total power of round about three horsepower The maximum speed that we measured by GPS is 38 kilometers per hour And that's quite a lot when you're sitting on a Bobby car that's It's cool To control them we use analog joysticks that we glued and molded into the steering wheels This model have a joystick glued onto it and the other one has one actually lasered into it and Our next application that we have built and the oldest one is our moving armchair We have built that for the Shah last year It only features a tennis lithium-ion battery, but that's already enough for an armchair It has an PPM based remote control You can get these from eBay for want about 40 euros So it doesn't matter when the room remote breaks because there's only a 40 year remote and not a 300 euro remote And the remote will break when you're moving when you have a moving object It has a wheel wheel wheel drive and only drives up to 23 kilometers per hour And it's based upon a solid steel frame We started that with a wooden frame, but we'll see the frame later. That doesn't didn't work out and The next application that we have built for the Congress in Leipzig that are our transporters They also have the tennis lithium-ion battery from the hoverboard and they have a quite special input They they get the signals via a game truck Game truck is what Sony sailed in 2004 for the PlayStation 2 as argumented reality Game truck works by having a wire tight to your hand and Then fixed on the ground Then the length of the wire and the angles of the wire are measured therefore you can play golf and Have some argument argument reality golf with wires tied to your hand Didn't sell that well, but you can still get these game trucks on eBay and the controllers are really the interesting part Look like this. We have Potentiometer here a wire fed through it so you can pull there We have a spool here and when the spool when the wire is Teared away from the spool this potentiometer will be turned therefore you can measure the wire length and two angles of the wire which then looks like this wire and With the wires the transporter knows the length of the wire the angle of the wire Therefore We can pull things up to 100 kilograms Also these transporters and have safe have a have a few safety features because Autonomous moving platforms not that cool with people and We have we have four of these transporters working and they all feature Remote Cutoff so when a transporter turns off all of them will turn off We have a remote when we press it all present all of them will turn off And if there's an error all of them will turn off. That's also a quite handy feature They all have a display Connected wire via ice pot see which tells you the current battery voltage to the current Which is drawn and the length. That's why I said to We can also use the on-off button to change the length of the wire or the preset for that and as already Said they can carry up to 100 kilograms, which is quite a lot and we have Advanced version a single transporter which features LIDAR that transporter can actually kind of move by itself Create a map of where it was and then can re-navigate there But that does not work that good on events as there are too many people too many tables Not enough walls for the transporter to remember Okay, that was a video if this one was broken Before you build your moving objects now, there's a few mechanical considerations that we might want to take and and One of the most important things is that you want to use a very stable wheel suspension As I said earlier our first armchair was based upon some wood and it didn't even last to the next tent on the char So don't do that. It will not work out that good. You can do it with some very good woods For example multiplex was it called which is quite stable, but if you have the tools and The time consider making a steel frame. It's really worth it This frame we welded on the charm and it's still operational and not broken The armchair itself is broken But the steel frame is still okay So we can unscrew it take a new armchair and screw it onto the steel frame. So that's quite handy and Also very important is to use protection for the mainboard not electrically Also, electrically, but also some mechanical protection the first Archer like this version had no protection and we had once a rock flying up hitting one of the caps and breaking it off breaking the cap off and Also, that was not that cool It worked but not that long because the second cap also fell off short after and with no caps a motor controller Will burn Another very important thing is to use very good silicone wire and a wire with Lots of copper strains in it and which is also very sturdy to mechanical vibrations we once or I once used some aluminum wire from loudspeakers and It broke off while while we were driving because of us the wire use aluminum wire is a very Stable, but a brittle wire. So when I'm a mechanical stress it will break and Therefore the ground wire broke off and all the current flew back through an Arduino. That's also not cool And if possible, you should use a milt motor mount We milled one here for our Bobby car Also for this Bobby car. It is really worth it You can screw the motors to it very easily. It's very sturdy. No problems. They are I am so if possible do that. I guess we can also provide the the file for this motor mount if you want to have it and and Not I am as this already is still the Bobby car and A thing that we did here which worked out Surprisingly good is a 3d printed motor mount for the front wheel and Last last very good, but for next version we will also mill a motor mount there Yeah, yeah And another idea we came up with but we already seen some other people came up with it too is to use the original hoverboard framings by Cutting them on Removing the middle part and then screwing them to a wood plate This is what we did here with the transporters and that works quite good So with every hoverboard you buy you get two very equaish hoverboard mounts with it mmm, that's quite a nice thing and Another electrical consideration is you might want to take when you use Some inner look voltages to control your main board noise will be a very heavy problem as you Will have some very long cables between your input the puncher meter and the main board It's always a very good idea to solder some 100 nanofarads or a little bit more caps onto the main board directly to the ADC pins on the input wire Without them you you will feel that your main that you are moving objects is a little bit vibrating moving That does quite a lot. So When building a moving object that might be an idea on the PCB we showed earlier you can also solder in some ADC Capacitors to smooth out the inner look voltages, but still it's a good idea to solder some to the original main board This is another application which where we did nothing Where we didn't do something with it yet But some people from the internet sort of might be a good idea to use these motors as robotics Attentionators and that is actually a quite good idea because these motors have quite a lot of power they are 18 pole brushless DC motors and With an encoder you can make it quite good brushless DC servo The two images on the left are from Metcow He's a guy from the odd rife forum. You may know the odd rife. It's also a motor controller He does quite a few things with that if you want some more informations you can Go there and check that thread out. It's a quite nice thread On the right picture. You can see a motor that we open. It's also possible to drill through the motor shaft and then Fix a screw into there. So you have a motor which can be mounted on two sides The original motors only have a mount on one side, but you can change it to a two-sided mount if you want Quite some work, but it's possible And that concludes it Can see here our Bobby cars we're driving up to 40 kilometers per hour, which is If you have any questions you can ask them now you can ask them as via Twitter can see our handle there and As you might already know, we will have hands-on workshop later on 15 o'clock Yeah, I guess most We will have a few kids there, but I guess there's already quite a few people who will want to Attend to this workshop. So we will have to see if everything fits. Yeah, I have the current status So we have 22 People coming to the workshop. We have 20 kids. However, we have 25 kids So five more kids where only the wee nun shark is missing. So if you can Get like a wee nun shark or it's okay to borrow a nun shark from and from someone you can still join their three more Seeds left also, we would like to give a special thanks to René hopp and Nico Stute from the STM BL project who helped us With the initial work on the firmware like hardware initialization of the STM 32 and so on So if you look at the commit history, they did some work at the very beginning of the project. So yeah, special Thanks to them. Yeah, that's it from our side. I think we have about 15 minutes left for questions Yeah, please please ask them So are there questions, please wait so I will come to you So in terms of moving heavy things as opposed to moving things quickly, there's a higher battery voltage result more starting talk Yeah, of course As I said before Like the main thing limiting your power especially at high speeds is the resistance of the motors so with a higher With a higher battery voltage you will get higher speeds, but also higher talks. However at Low speeds like when you start moving the thing limiting your current into the motor Shouldn't be the resistance of the motor because that is really really low. You will burn your motor So the software does some current limiting and you can set the value for the current limiting in the config file So if you want to get more talk you can change this value To like increase the torque or reduce the torque if you want likes move on starting driving behavior Also like torque depends on the motor size. So these hoverboard motors comes in three sizes This is the in a six inch version. There is a eight inch version which has also rubber Around it and there is a 10 inch version which has air filled tires So all these motors have the same power. So with increased Diameter you will get higher speeds, but of course lower torque so for Bobby cast these small motors are fun because you have like Really high acceleration for example for our armchair We choose bigger motors because for it we wanted to have like longer distances to travel And therefore get higher end speeds. So yeah, that's what you can do to change throttle or to change torque or speed any other questions So no more questions then give them a warm round of applause and thanks for the talk