lauantai 25. elokuuta 2018

Take a break. Really.


Here in Europe the "live-to-work" attitude so common at America or (eastern) Asia isn't really that widespread. For example in Finland work week is 40 hours, anything above that is overtime (and there are legal limits to that, too), and people working have up to six weeks of vacation over year, not counting official/bank holidays (like eastern, Christmas, independence day or so on.)

Some people still do work more, though, and right now I have to admit that I haven't had a real vacation this summer either. Granted, since weather has been very hot (close to 30 degrees C for several weeks straight - essentially unheard of here as one or two days, maybe one week of sequential 25+ degree days is more typical), and air conditioning isn't really widespread, it's nicer to sit in office with AC on than at home anyway.

I've been really busy working out final kinks out of our new product. This isn't first time I've made a new product either, but even then amount of work needed to finalize a product still catches me every time. All the small details, previously postponed, suddenly turn very important.

Even during this process I multitask. By necessity of course - many very different things to do (including upkeep of older products) - but I don't really mind that. It's actually good. It allows taking a bit of distance to certain things.

For example, I've had this damn annoying random crash issue with one product for some time I couldn't figure out. It just crashed, seemingly for no reason. It's been there for a long time. Previously I just gave up, deemed it to be minor enough issue that it could be postponed and went with it; the product, after all, recovered gracefully (as designed) and resumed operation after a second or two.

Spoiler alert: It turned out not to be minor at all. Constant issues, especially unexpected, seemingly unconnected ones. Crap.

However, several months of break with that code base allowed a completely new, fresh perspective on the bug hunt. So after only a few days of troubleshooting I had the answer. Interrupts within interrupts. They behaved badly in this codebase. Had always done so, but before, the module did much less, and interrupts managed to interrupt other interrupts much less often, so issues were much less frequent, almost hidden.

Few very small tweaks and problem appears to be gone. Now there is just the issue of distributing the fix, to devices that are not field-upgradeable... D'oh. But thas is beside the point I'm trying to make.

And this is something I've said before.

The fix here was the same as so many times before. And you know it too. All the week you've been banging your head onto an issue, without solution, working overtime. On weekend you go home, get wasted or whatever, return to work on Monday and the problem is obvious and fixed in no time whatsoever.

Can you see the solution here? It's time actively not working on the issue.

Take that break! Go to have a long weekend! Throw the keyboard on the wall and walk away! The problem will be there when you come back after a few days - or weeks - and by then you'll probably know the solution to it already. And that will be only by not working on it.

Your brain has this amazing capacity of background processing. Use it wisely, and you will never have to work past that magical 40 hour mark - or maybe 30 hours even - to finish your work.





lauantai 18. elokuuta 2018

Tiny drone


Some time ago I bought, mostly out of curiosity, a tiny drone from verkkokauppa.com, named RedBird Nano Cam. It wasn't too expensive, but then again, it isn't too great at flight either - fairly unstable and hard to direct even in best circumstances.

Here's the thing, without propellers (rotors?), with two euro coin to give  a bit of size reference. Although the bird on top looks quite blue to me...


It got some abuse too, in the twitchy hands of kids, so it got dropped often. So I guess it was to be expected that it would be short-lived toy. And eventually it did stop charging. Best guess, kid left it on and that killed the battery dead.

So what a curious engineer does when that happens? Yes, break out trusty tools to see what's inside...


Top cover off at this point, and I had already done some damage by not noticing four screws that  keep top and bottom covers together. D'oh. Nevertheless, the green board is the camera module, connected to main board only with only three wires. Interesting.


Camera module off, it wasn't even glued or taped down. Camera module also has place for MicroSD card it.
On the main board there are three main chips;

Invensense MPU-6050C - combined gyroscope/accelerometer module, apparently one that is very widely used. I've been considering using similar chip for one application I've been thinking about, but unfortunately I haven't found suitable gyroscope yet - for the application I'm thinking about I'd need around +/- 10000 degrees/sec operating range, but most seem to be around +/- 2000 degrees/sec range - this one included. Not even close to sufficient.

ST Micro STM32F031K4 processor.

XN297, a 2.4GHz transceiver chip.


The other side. In corners there are motor driver transistors, and in middle a clock crystal and few programming test points. All in all, quite simple thing.

I tried measuring the battery, and it read exactly zero. When trying to charge it, voltage rises to about 0,2v. It's dead, and I don't feel like trying to figure out why either (earlier speculation aside) Might as well get rid of it, except that fun-looking camera module ... I can think a few uses for it immediately.




perjantai 6. heinäkuuta 2018

Electric cars with space


So far all the fully electric cars have had ... well, anemic interior space. With family and two large dogs, small hatchback just doesn't cut it.

Now I found out that there is Audi e-tron coming, and judging from exterior shots, this one might actually work for me, although promised 400km range, while sufficient, isn't great - I had hoped for 600km range at this point since charging stations at the moment are unfortunately rare around here, limiting the route selection possibilities severely.

Now, will I be reserving one? Well, that's almost certain "no" at this point.

Like Tesla, this appears to be targeted towards luxury/high-end market, with gadgets, features and  power to match.

This will, very likely, make it Very Expensive Car to purchase - they are not telling the price, but I will be very surprised if it's below 80k€ around here (granted, Finland has pretty high tax for cars) for base model (whatever that means in this context).

That price is simply way too much for me. If it were, say, 50k, I could consider it. No, wait, that's almost certainly wrong, I'd almost surely buy it at that price point! That figure is, by the way, what the hybrid Outlander cost me. But anything above that I just can't really stomach. Even when the car I am looking to replace - gas-guzzling Santa Fe '03 - is starting to show its age, and not in a good way.

So guess I'm back to waiting for the tech to come down a price group or two...



perjantai 29. kesäkuuta 2018

The final walk.


Again, one completely post with no electronics content. This one is about dogs. You have been warned.

When we were having our (first) dog to be inoculated for the first time, we waited in the waiting room of the vet with all the other waiting to see the vet.

While waiting, I noticed a man, maybe in his 60s or so, coming from behind a corner and just slowly walking towards the exit, eyes strictly forward, with no expression on his face, holding an empty leash in his left hand.

Few seconds later a woman, also in her 60s or so, walks around the same corner quite obviously in very serious distress, all but crying, following few steps behind the man towards the exit.

It took me a few seconds to make the connection, but the dog of this couple must just have had his very last walk on this earth.

The dog we had inoculated that day is still with us now, nearing his first full decade of life, but with some ailments that mildly degrade his quality of life. Nothing that would ail him seriously, not yet at least. He will still have many good years here, but day by day, the day when I will be taking him to his final walk is approaching.

And I am quite certain that when that day comes, I can't be as .. unemotional .. as the man I mentioned before.


perjantai 15. kesäkuuta 2018

Bluetooth LE


I've been playing around with a new Bluetooth module kit, and specifically BLE (Bluetooth low energy) lately. At first entire bluetooth system - nevermind new LE-specific features - seem really daunting, but after essentially diving in it is becoming easier - piece by piece.
All the profiles, advertisements and whatnot seemed overwhelming at first, but when I got to tackling them one by one - essentially by playing around with this developer kit first, then doing some reading, then some coding - things get much easier. Although a "big picture" view, when getting started, might have helped a lot.

Main point of BLE is there, right in the name - low energy. Peripheral devices, whatever they might be, are supposed to do everything and anything to keep their power consumption low, by spending most of their time doing what they do best: absolutely nothing. This is how all electronics with extremely low power usage work - you want to do absolutely nothing as much as you can, only waking up every now and then to do as much works as is needed, as quickly as possible, then going back to sleep.

100mA power consumption in active mode may seem a lot, but when you only spend, say, 1 millisecond in active mode and remainder of a second in deep sleep (where current consumption might be just microamp or so), the overall figure is still pretty good, although still dominated by that short burst of current usage. Therefore you'll do anything and everything to keep time being awake as short as possible and as infrequent as possible. Can you do energy-intensive actions only every 10 seconds or so, instead of every second?

Counter-intuitively this also means that your MCU (or BLE module) should run at highest possible clock rate for the short duration there is work to be done, then go back to sleep.

Now, the MCU or controller or BLE module you're using is not the only part of the circuit. In order to reach that minimal current consumption, you must also design rest of the circuit so that, too, takes as little power to run as possible, especially in deep sleep. After all, it doesn't really help to have your MCU at sleep, taking only 1uA, when rest of your circuit takes 1mA on top of that!

This part can be very challenging though. In case of my idea the circuit needs to both be always active (so every short event is noted; MCU can sleep, but remaining circuit needs to stay active) and highly tolerant to external interference (which in this case requires higher currents to be used in measurement part). A bit of a conundrum, that. At the moment I don't have a good solution to this at hand, but I do have some solutions - not great, each with some drawbacks, but nevertheless, I can make this to work. Not at optimal level, but it's still better than none at all.







lauantai 9. kesäkuuta 2018

Found it!


Almost two years ago, I managed to lose my BT headset module. Now I found it! Apparently it ended up very near the place I looked for it at, just a meter or so from where I tried to look for it,  near a wall. As the spring plants today hadn't grown yet so it was really standing out there.

After few moments of thought I tried charging it with typical wall USB charger. Surprisingly, it lit up, indicating being charged. Unfortunately it stopped charging very quickly, which I considered bad omen already. So next attempt - turn it on.

No luck. It's dead. Next few charging attempts ended up with similar fate - tries to charge, then stops very soon - can't. Not very surprising, really, this was on when I lost it, so it would have drained its battery very quickly, and after that it was allowed to drain the battery further for almost two years. If it weren't dead, I'd had been more surprised.

So, next thing was to tear it apart, to see what's inside. My first guess: One PCB with one to three active chips and a battery.

I thought that the enclosure might be ultrasound-welded or something like that, but no, it opened way too easily for that. Just snapped together. Absolutely not even water-resistant, really, but then again, I don't think that it even advertises as such, so no problem there.

Snapping it open, first glance was pretty much what I expected. One PCB, with buttons, leds, few passives and PCB antenna at the end.


Taking out two tiny screws, we get to see the other side. Battery and rest of the PCB components. Curiously batter could have been larger (I'd really want that!), but guess they thought 4-ish hours is enough. Hint: It isn't.

On PCB the main chip appears to be ISSC Technologies' IS1681S chip. With brief search, I found IS1690S datasheet, which, unsurprisingly, is a small BLE 3.0 chip with 8051 controller built in (is there a place where 80C51 isn't -- that chip is amazingly common, and amazingly powerful too, considering its roots in early 1980s). The other chip there seems to be 24C34 (I don't have my microscope handy at the moment), which would mean I2C EEPROM for storing pairings and other such data.



And that's about it. Unlike devices of 80s and 90s, these days this is way too common setup. Dedicated chip, with few support components, and not much else. Granted, this allows to bring the price down, but it's still kinda let down...


torstai 31. toukokuuta 2018

Card games


I've never been to card games (be it real - say, Poker - or virtual - say, Heathstone or Gwent) much. Any game I've tried, I've lost interest pretty quickly. I guess those just aren't for me, for whatever reason .

That being said, I have tried Magic the Gathering too. This was somewhere around 1996-1997, I think, so more than twenty years ago now (...damn, doesn't that make me feel old). Even then I pretty quickly found out that it wasn't for me, so I just packed up and put my cards into storage. There wasn't any really great or even good cards there, by that day's standards at least, so I didn't even bother trying to sell them. Now, though, I have to wonder if those cards would have gained some value over the years...

The thing is, I've packed a lot of things away, in cardboard boxed, in relatively random order. Without any labels. And there are many, many boxes at this point.

Finding those cards might require some serious digging.