lauantai 30. syyskuuta 2017

Looking for help at the net


Gotta love Analog Devices. They make absolutely great chips, such as nice ADuM4160 USB isolator. This chip offers full isolation for USB bus, completely separating electronics on your PCB from PC controlling it and preventing that magic smoke from escaping due to serious voltage differences between the two devices, and this without having to use secondary power source on PCB (granted, in case of USB this is of a lesser deal, but for buses like RS485, not having to build isolated power supply for is a big deal - and there's chip for that too.)  But the thing is, this chip - and many others AD makes - aren't cheap. This one was around 10€ a piece in low quantities, if my memory serves. But then again, if your industrial PCB costs something hundreds of euros, taking precautions against stupid users might be worth it. That's who the main customers for this chip - and others like it - are.

That being said, I was testing this chip in case I need it one day, and found out that when using it, USB wasn't working properly. It tried to, but failed to establish connection. Hmm. Curious, as I thought I had followed documents to the letter when designing test board. And since AD hadn't bothered to even include an example schematic in their datasheets (why?!?), I fired up google image search with "ADum4160 schematic".

And oh boy, I don't envy anyone trying to get their circuit working based on those schematics. There are functional ones there, sure, but some work only in specific cases, some of them are completely wrong, and quite a few subtly wrong so that it may work - or not. Like this add-on board (that I shall not name here) that doesn't have any bypass caps for ADuM anywhere on the board. If that one works with any reliability, it'll be due to pure miracle.

Anyway, I managed to get my ADuM working eventually - small issue with supply rails that I didn't notice when initially reading datasheet, going to "specific case" mentioned above, found out by examining some schematics and then doing some very careful reading of datasheet - but damn if I had to rely on internet with things like this more often, I'd be in a real trouble.

So, go on and search the net for information. But be wary of any information supplied - it might be wrong. And yes, that includes stuff I write here, too.





lauantai 23. syyskuuta 2017

Shortest camera life yet


Our old Canon point-and-click camera that we got maybe 6 years ago finally got damaged enough not to work anymore. So wife went and bought just about cheapest possible camera - specifically Nikon Coolpix A10. Price wasn't that bad either, some 85€, taxes included.

And kid dropped it on the lens which broke on the very same day. Specifically the objective/lens mechanism that moves it to storage position got stuck, most likely by breaking or jumping off the thread (rail?) or whatever.

So what are our options? Home insurance? With deductible of ~120€, that's a no go.
Return it for refund? I'm too honest for that kind of fraud.

That leaves me with option three; open it and see what could be done. But I wasn't too hopeful to begin with. Those mechanisms tend to be damn complex and in general difficult to work with, and this being plastic didn't exactly fill me with any confidence.

I can almost hear someone out there screaming about opportunity cost, but a) I just happen to be curious enough to want to see how they're build, and b) unless you actually do get paid in full for the time spent, opportunity cost is generally nothing but an excuse to avoid things you don't really want to do. Like actually saving money by cooking yourself. But I digress here once again...

Opening the camera wasn't that difficult. Some six screws and small amount of force popped front and back covers off. After looking for way to get logic board off, I peeled some tape off the boards. And next thing I found out - painfully - that camera apparently keeps the flash capacitor (330v 100uF) charged all the time. Ouch. If you open this up, be careful with it, 10k resistor is handy for discharging it. Just don't hold the resistor leads with both hands! (doubly ouch, and might do more than just hurt). Preferably hold it with no hands, like with well-insulated pliers.

After that display and it's holder came off with few screws.

The system integration is damn impressive on these things. There is a small PCB on front of camera, just for LED, and on top there is another for for buttons and flash circuits. Those are connected to each other and main logic board with solder joints, as well as the battery contacts from holder come through the main board and were soldered on. It took a while to figure this out and to pry main board off. Lead-free solder joints are damn annoying to get off sometimes, especially if there are large ground planes involved.


After getting logic board off, the lens mechanism came off as module, pretty much as I expected. 


There are two flexes going to the module; one for image sensor and one for motors and whatnot. No need to get sensor off, really.

This package itself was hold closed by I think five plastic clips. Four of them are easy to get to, but fifth is under the motors flex and damn small. Small, sharp and sturdy pin with small screwdriver is the best method to get it open.


Left is the cover with CCD, right is the mechanism.

And this is pretty much where I gave up. The motor (large-ish and metallic colored, on left of mechanism) seems to drive the opening mechanism, but the large wheel down there was seriously stuck. I could not find out any way to open this non-destructively so that was it.

I put it together (making sure to salvage that nice flash capacitor first), leaving everything (including battery holder) unconnected. This is kept as reminder and practice piece for the kid - no more cameras for him until he can handle them without dropping them constantly. Sure, it won't be fun to  play with as it doesn't do anything, but that's all he's going to get for now...

If I could salvage another A10 somewhere, with, say, broken screen, I might be able to build one functional camera out of them (again, more for curiosity and practice than saving money), but even that is only worth the trouble if I get the other camera for essentially free. 



lauantai 16. syyskuuta 2017

Whether one should have hobby projects


Long time ago, when I was just studying and not being working, I enjoyed having my own projects to work with. Being primarily software guy, this of course was projects I could think of. Utilities, games, tools, anything like that. Lots of them, in fact. Some gained some interest, but nothing spectacular. I had plenty of time and energy for that.

Then I got work as software developer. Part-time at that point, but still. So now I am programming some four hours a day for work (plus studying, this being while I was still in university), and much of that (work) was actually learning about things around the main job as well - things like physical environments and how they affect signals, math around stuff, programming tools and concepts I hadn't encountered before and so on. Fun stuff, really. I always love to learn new stuff that interests me, and money is kinda big motivator for learning.

Then I graduated and previous part-time gig became a full-time job. And suddenly I didn't really have any energy left for my own projects any more. Will, sure, but energy, not really.

Over the years I've figured this out in more detail. Part by reading, part by experience.

It's said that programming is creative work. I absolutely agree with this, even if you are dealing with what could be called boiler plate code. There is just so much of creative effort you can squeeze out before it gets depleted. While I may not be painting Mona Lisa, or sculpting David, there still is is structure of program I'm writing that I have to keep in my head while working. Small problems are almost nothing, but big frameworks, bug structures, still existing only in my head, are fragile things. Keeping them in my mind is an effort, and a very taxing effort at that. And badly timed interruption can smash entire thing to splinters. There is a limit on how much you can keep such thing in your mind.

My personal hard limit seems to be at around five to six hours. After that there is a wall I run onto, and no matter what I do, I will not be productive software developer again until after proper rest - that is, a good night's sleep.

I can do other things though - say, assembly line type work, or anything completely different that software stuff - but then again, at my current position I am kinda lucky I have that escape route. If I were working in usual 8 to 4 office setting, there might not be anything else to do but sit there feeling useless.

Documentation, testing, all that - it's essentially same work, in different format, with different difficulty applied. I can try to do it, but in the end the quality will be sub-par. It's better I don't even try. So, five to six hours of serious work. And I am not even surprised that I don't have energy for hobby projects any more after that, not any more.

I'm not the only one, mind you. The consensus on the field seems to be that six hours per day is already pushing it.

Now, common theme in industry seems to be that one should have those hobby projects. Employers seek to people with those interests.

Now, wait a moment here - as an employer, you want that your people have energy left after work day to seek out extracurricular activities? Really, do you really want that your people you employ just waste their time - time you pay for - doing whatever, only to have enough energy for those hobby projects too?

Really?