Repairing a self-balancing electric unicycle

Apparently, the gyro in the MPU-6050 can withstand 10,000g for .2ms. Which seems to be slightly less than the force of a punch from a mantis shrimp. Not so shrimpy, eh?! (Sorry, I’ll stop!)

1 Like

I was curious, so I looked it up. According to this how stuff works page, the segway uses the same type of solid state gyros that this unicycle does. @wandrson I think this answers my terminology problem; solid-state vs. traditional.

I would expect so; MEMS units are inexpensive, reliable, tiny and common. Spinning gyroscopes are bulkier, cost more and are more sensitive to damage from shock.

I am not familiar with the STM family. Try looking for a serial wire debugging interface.

Edit: Ah, the red and green wires with signal names starting with SW look mighty suspicious…

Damn. I was curious, too, and looked it up, too, and skimmed that same How Stuff Works article. How in the world did I completely miss the section explaining “solid state gyroscopic sensors”? Had I paid attention there, I could have learned a lot more a lot sooner. I hate it when I do that. But I love it when someone can show me the error of my ways, and you’ve done a great job here of edumacating this guy. I expected to find a mechanical gyro about the size of a quarter housed inside a plastic box in this thing, to be perfectly honest. Now I know better.

So, now I must wait patiently while you work in hopes I won’t miss anything else…

BTW, shrimp punch made me LOL.

@Karl,

I know this is getting picky; however, I don’t think solid state is an applicable term for MEMS devices. It is normally taken to mean an electronic device without moving parts. I would suggest you stick with the term MEMS for these devices. So you would refer to MEMS vs traditional.

MEMS is a useful and accurate acronym; micro-electro-mechanical-systems.

1 Like

For your edification, you may find the following useful; it lists devices of which I’ve never heard, despite a lifetime of reading about them:

1 Like

On further review, I gotta agree with Walter, and, although he did not state this, I’ll extend it to say that the language used in the How Stuff Works article is misleading by calling the MEMS-type gyroscopes used in the Segway “solid state”. I doubt they are the only source to have done so, but since the article from Digikey refers to “moving electrodes (rotors)” and “fixed electrodes (stators)”, I’m going to say this trumps pretty much any other source who might refer to these as “solid state”. Also, the very next paragraph states that silicone particles are caused to move across the plate, and, unless “silicone particles” means subatomic entities such as electrons, I don’t think this can be considered “solid state”.

I agree as well, and @wandrson I definitely don’t mind getting picky. The fact is that MEMS devices are inherently mechanical, and solid state means no moving parts, even if they are small. I will just have to use traditional vs. MEMS, but at least we have it sorted.

@Bill It looks like your hunch about the SW pins is correct. Apparently, ARM uses something called SWD (Serial Wire Debugging), which unlike a JTAG connection, only requires two pins. I’ve ordered a Segger J-link which is compatible with JTAG and SWD. While I wait for it to arrive I’ll have to research out how to use it…

1 Like

Super. Good luck with it…

It looks like I need to get a small class together and show y’all how to debug ARM micros. :wink:

Ed Krone (forgive me if I got that wrong) was asking about this already. Seems like there is some interest.

BTW, if you want to go “cheap” on Serial Wire Debug, Olimex makes a rather inexpensive JTAG probe that does it. The probe also does normal “4 wire” JTAG-DAP as well.

1 Like

I am considering buying the Atmel ICE, though it may only work with their versions of the ARM. It also does AVR, so two for the price of one…

Wow! What a discussion! OK, I really have little time to mess with anything else but I HAVE worked with solid state gyros… Oh SUUURRREEE… there are moving parts… there are moving parts on Molecules for crying out loud I also have met the inventor of the Segway… and he considers the gyros solid state… But Hey that’s not why I am even writing this… What I am curious to know, is what the plan is for this thing. More because of curiosity than anything else. I am curious about what you have learned about the workings. There are some websites about, “How to build your own Segway” and you might find that useful. It also sounds a lot like the Inverted Pendulum that a few people in DPRG have developed. There are also IMUs available from Sparkfun that could help balance this unit. Anyway, I was just interested to know what was wrong with the original working from a repair standpoint.

You may already be aware, but for the less observant like myself, be sure to check the original post for updates go the ongoing troubleshooting. I only reized today that Karl had posted several things back to the original and likely will likely continue

The Documentation of the STM32F302 suggests a two wire serial JTAG and says it shares the pins with SWDIO and SWCLK and a “Sequence” on the TMS pin switches between the two. It neglects to mention what that sequence is. Just as a suggestion, unless you can find instructions for using the debug and information, it might be better to focus first on what happened to the unit. A crash tends to mean something out of place or damaged. With any luck it is not damage to the MCU. I would GUESS, it relates to the MPU-6050. If there are more than one, it might be an alignment between them such that the balance is determined by a predetermined “agreement” between two or more MPUs. I’ve actually used the 6050 and it is a pretty nice chip. In my scheme the MPU (an Arduino in my case) sends programming to the MPU on power up so I think yours could be replaced if it comes to that. They are, by their nature, sensitive and there might be an alignment procedure that requires reading the debug connector. What make of unicycle is this?

With a physical crash and subsequent charger failure, the first thing I’d do is make a quick check for missing capacitors and other massive parts in the power supply section.

@steve_a I don’t think there is a problem with the MCU, in fact given the symptoms, I would be surprised if it had any issue. I think the problem is bad data from the MPU. I am hoping that by getting diagnostic data from the MCU I might be able to read the raw data coming from the MPU and see if it makes sense or not. The unicycle is an IPS T350.

@benemorius Indeed, the first thing I checked for was any obvious burned components or blown caps on the board. Came up with a blown fuse. After replacing the fuse, the thing still doesn’t work, but does power on. Next I checked for other physical damage such as an out of place hall effect sensor in the wheel hub, but nothing seems amiss physically. If you can think of anything else to check please do share. I would much rather find a simple fix than have to go down the debug rabbit hole. On the other hand, it would be a good learning experience.

Having not seen the unit I’ll make a guess that the hall effects are a speed and possibly position sensor system. I assume there are magnets the sensor(s?) detects. It is possible that a magnet was dislodged or the gap between the sensor and the magnet changed. The good news is they are simple and you can check them with a scope or meter. The MPU6050 is much trickier to troubleshoot. Without a method to communicate with them it might be best to just replace them. They are abut $13 or so but they are surface mount so that is an issue. And that might be a problem as well. If the crash caused the solder to crack, then there would be a loose connection. Not really likely but possible.
Anyway, checking hall effects would be a good thing to try.

Yep, I think my next step will be to replace the MPU.

If you haven’t yet, it’s always good to check the voltage rails with a scope before doing anything else, and that’s especially true in this case. The failed charger and blown fuse are pretty strong clues. It’s almost impossible for a bad accelerometer or microcontroller to cause either. Given these clues, I’d want to be quite sure the power supplies are in good order before looking elsewhere and certainly before replacing parts.

Might your friend let you bring it to the space? I’d love to have a look at it.