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...