Jan Rychter: blog (electronics, programming, technology)

New in PartsBox: Tags


I've been thinking about how to provide good features for organizing parts in PartsBox. When thinking of organizing, most people think of categories — but categories are actually not that practical. A category tree requires a lot of work to set up and maintain, and parts have to be assigned to categories manually. Even worse, some systems only allow you to assign a part to a single category. Does that 7805 regulator belong in "Through-Hole Parts" or "Voltage Regulators"? All this means that there is a lot of manual work, with little flexibility and power.

Tags are a much more flexible approach. You add tags to parts, and then instead of a static category tree, you use searches or smart folders to find parts with a given tag set. That is great in itself, but I wanted to go a step further — what if you didn't have to do all the tagging yourself? Could we add at least some tags automatically?

It turns out that it is possible. Auto-tags now get added automatically for linked parts where there are specs available. It's a small set for now and they aren't always perfect, but you can already search for #smd, #tht, #resistor, #capacitor, #0603 and similar. And it's fairly amazing to be able to just enter "#0603 #capacitor" into your search field and instantly find all the 0603 caps in your collection, without doing any tagging work!

How to use tags? For searching, it's enough to enter a #tag in the search field. Tags can be combined with normal searches. If you enter a tag, or several tags, only the parts that have all of the tags will be considered for search.

Tagging can be done either for individual parts, or with a mass add/remove tags operation on selected parts.

Happy tagging!

New in PartsBox: Projects (BOM management)


Managing lists of electronic parts has long been near the top of the requested features list. A BOM (Bill of Materials) lists all the components required for a project/build, along with their quantities, comments and pricing information.

PartsBox has just taken the first step towards BOM management with its "Projects" feature. It is now possible to create projects and add parts to them. PartsBox will let you know if you have enough stock to build a given quantity of a project, it will also conveniently display which storage locations you will need to access. It is possible to remove stock for all project parts with a single click.

Project notes support Markdown syntax and can be used for short notes or even a full project log.

Note that projects can contain any parts, not just those that you have stock for. This means that PartsBox can be useful for planning future projects and purchasing. In fact, commercial users will have access to pricing and purchase planning features (given your planned builds, distributors' price breaks and your cash on hand, how many of a particular part should you order?) in the future.

Also, there are plans for allowing projects to be public. A public project would have a web page with project notes and a list of components. This is very useful for maintaining up-to-date web pages for open-source hardware projects.

I hope you enjoy the new features and have fun building electronic projects with PartsBox!

New in PartsBox: a real search engine


You asked for it, and here it is: better search in PartsBox. The previous search was really a filter: a simple substring scan. It was good for a start, but you asked for something better, which could handle multiple words.

PartsBox now has a fuzzy-matching search engine that is designed to match electronic components well. It tolerates a certain amount of misspellings and still gets the right results. And most importantly, it runs right in the browser, and also happens to be faster than the old search for non-trivial databases.

Fuzzy-matching is really great. For example, searching for "61a20dwp" will bring up the TPA6120A2DWP which you really wanted, and typing "mcp78381" will show the MCP73832T-2ACI/OT that you have in stock.

The new component search engine has also been written in such a way that it can run both in the browser and on the server. This is great, because it provides scalability: for companies with large part databases it won't be a problem to keep the index on the server and run searches there. In fact, tests show no noticeable difference in performance as we switch from client-side searching to sending searches to the server.

The new engine indexes component names, descriptions, footprints and user notes by default. A few hints on usage:

  • In general, just type what you're looking for, and it should Just Work.
  • If you're looking for separate words, type them as separate words, but if you remember the beginning and ending of a component name, type it as a single string.
  • There is no "special syntax", such as phrase quoting, prefixing with a "+", or anything like that.
  • The engine will tolerate a certain number of typos/misspellings, but there are no miracles: you have to get at least part of the name right.

Another important change was introduced to the Storage table. As it turns out, the "Part Count" that used to be displayed there was confusing and not very useful. It was a count of distinct parts that are (or were) stored in a particular storage location. You could think of it as the number of labeled zip-lock bags in that location. The bags could be empty (if you used up all the components), but they would still get counted. This resulted in a significant number of bug reports. The number has been replaced with a "Stock" number, indicating the total stock for that location.

A number of small bugs were squashed, among them linkification: the process of detecting links in your note text and turning them into HTML links. It turns out this is surprisingly difficult to get right. Hopefully I got it right this time.

There were also lots of under-the-hood changes, which should not be user-visible. These either result in better performance, or lay down the foundation for new features which will come in the future.

I hope the new search engine will improve your workflow when working with electronic components!

Leaving Squarespace


After several years the time has come to move my blogs from Squarespace. It was a strange relationship: I run my own servers and I'm certainly capable of implementing my own blogging solution, but using Squarespace was just easier. I could never find the time to do something of my own. So, even though I wasn't entirely happy with how Squarespace worked, I kept paying to have my pages hosted there.

The proverbial straw that broke the camel's back came recently. As I was leaving on vacation, I got an E-mail from Squarespace about them being unable to charge my credit card for another month. Not surprising, as my credit card expired a couple of weeks ago, so I had a new expiration date and CVV code. What was surprising, though, was that Squarespace immediately proceeded to turn off my blogs and pages. I gave them my new expiration date and CVV code, but they said I have to re-register again. I asked customer support for one week of grace period, as I was on vacation with poor internet connectivity, but the answer was a definitive "No". My pages went 403.

Think about it. This is a company that takes pride in customer support. I have been a loyal customer for several years. And now, they are unable to give me one week of grace period? They begin with taking everything offline and responding with a 403?

This is not intended to be a Squarespace review — but if you're considering hosting your blog/pages with them, you should take these points into account:

  • There is no „relationship“: the moment your credit card can't be charged, Squarespace will take your pages offline. As in "HTTP 403 Forbidden" offline.
  • Customer support, while very responsive and polite, is only useful as an intelligent manual. They will help you with finding settings, but anything that would result in changes to the code is off-limits. As an example, I've been asking for years to make a change to the code that generates URLs for blog posts. They remove charactes with diacritics, instead of replacing them with ascii-lookalikes (so „łódź-2014“ gets transformed into „d-2014“ instead of „lodz-2014“). This is an eyesore and a disaster for SEO, and yet I could never get them to fix it. And I first reported it in March 2010.
  • If your site is multi-lingual, or even non-English, you will have a rough road ahead of you.
  • Squarespace will lose some of your data over time. Migration from Squarespace 5 to Squarespace 6, for example, lost high-resolution versions of my images. Only the thumbnails made it through. Some of the formatting was lost, too. It is up to you to write CSS to correct the more glaring problems.
  • Your data is held hostage. The export functionality is poor, broken and Squarespace has no interest in fixing it. While trying to write an importer for their XML export, I encountered a number of issues and reported them. After two months I finally got a definitive answer: the issues will not be fixed (more on this coming soon in a separate blog post). Only one issue got fixed: non-ASCII characters in exported comments are no longer lost (!).

This blog (and all my other pages) have been moved to my own server. I find it disappointing that I have to write my own blogging software (it's 2015 after all), but I'm getting used to it — I recently had to do the same thing to have private photo galleries for sharing with my family.

Goodbye, Squarespace.

System perspective: channels do not necessarily decouple


Clojure's core.async channels provide a great metaphor for joining components in a system. But I noticed there is a misconception floating around: that channels fully decouple system components, so that components do not need to know anything about one another. As a result, it's easy to go overboard with core.async. I've seen people overuse channels, putting them everywhere, even when a cross-namespace function call would do just fine.

What channels do provide is asynchronous processing. The "degree" of asynchronicity can be controlled — we may choose to always block the caller until someone reads from a channel (thus providing a rendezvous point), or we may choose to introduce asynchronicity, letting the caller proceed without worrying about when the value gets processed.

Since you can put anything onto a channel, it's easy to forget that this "anything" is part of the protocol. Just as functions have an argument signature, channels have value signatures, or protocols: the common data format that all parties agree on.

It isn't true that channels fully decouple components, so that "they don't need to know anything about one another". You still need a wire protocol, just as with directly calling functions in another component. Channels do decouple things in time: you are not forced to a synchronous execution model and can control when things are being processed. But they are not a magic component decoupling wand, so don't use them when a simple synchronous function call will do.

Hard Drive Encryption, revisited


Hard Drive Encryption, revisited

Several years ago I made a comment on Hacker News (full discussion) about full-disk encryption performed by the hard drives themselves. Basically, the idea is that you give your hard drive a password/key and hope that it transparently encrypts your data before it hits the platters (or flash memory for SSDs).

I wrote:

That kind of encryption is useless, because I can't audit it. How do I know my data really IS encrypted and the key isn't just stored on the drive itself?

Now, Hacker News has a number of well-known people, who have a following. Opposing their opinions is not popular. Notice how my to-the-point response to tptacek gets downvoted.

Anyway — I feel somewhat vindicated by the recent revelations of hard drive firmware hacking by the NSA. I was right: you can’t and shouldn’t trust your hard drives. If you care about encryption at all, your drives should see the data already encrypted.

I2C driver for Freescale Kinetis microcontrollers


I wrote a tiny driver that allows you to access I2C (IIC, I²C, or I squared C) on Freescale Kinetis microcontrollers. It works asynchronously (interrupt-driven), supports repeated start (restart) and does not depend on any large software framework.

The code is on Github and the driver has its own page, too, with a README.

Even though it isn't fully-featured or well tested, I have a good reason for publishing the code. I wrote this and then had to put my Kinetis-related projects on hold. After several months I forgot having written this driver and started searching online for one… only to finally find it using Spotlight, on my hard drive. This is what happens if you work on too many projects.

To avoid this happening in the future, I now intend to publish most things I write as soon as they are reasonably complete, so that I can find them online when I need them.

Fablitics Launch


We have just launched Fablitics — our friendly business intelligence and E-commerce analytics solution.

The driving idea behind Fablitics is that only meaningful numbers and graphs should be shown in business intelligence software. We tried to understand which numbers are important and can help decision making, and which bring little value and only confuse.

Early on we noticed that many analytics-type products show lots of data, but most of that data isn’t related to actual business.

Let’s take an example: page views and visits in an online store. They are related to the business, but very remotely. Estimating performance based on page-views could be compared to estimating the performance of a supermarket by the number of cars in the parking lot. Sure, that number is correlated with supermarket sales. Yes, probably the more cars there are in the lot, the better. Yes, the days when there is more traffic will likely bring in more revenue. But the relationship is too weak to allow meaningful conclusions.

So, when designing Fablitics, we decided to focus on fundamental business concepts: customers, products, sales. Instead of showing the number of page views, we count customers that visit the store. We determine which customers enter the store for the first time, and which are returning. We know how much each customer purchased, and we also know how the customer was referred to us, so we can put a monetary revenue value on advertisement campaigns.

All this is based on a rethinking of what analytics software should do. In our opinion, as long as the purpose is to improve the business, it should be strongly rooted in business concepts.

If you run an online store, you can sign up now for a free trial http://fablitics.com/ — no credit card required.

Lsquaredc: accessing I²C in Linux


It might seem that writing I2C libraries is my favorite activity, but it really isn't. This library is not something I expected to write, but since I had to, I'm releasing it in the hope that it will save others time and frustration.

Lsquaredc is a tiny Linux library that allows you to access I2C (IIC, I²C, or I squared C) from userspace without causing excessive pain and suffering.

When I tried accessing I2C on my BeagleBone Black, I was sure it would be obvious. Well, I was wrong. It turned out that the usual way is to read/write data using read() and write() calls, which doesn't support restarts. And if one needs repeated start, there is an ioctl with an entirely different and difficult to use interface.

For more information, see the Lsquaredc page and its Github repository.

Designing a High Voltage Power Supply for Nixie Tube Projects


PCB layout for the switch-mode HV PSU
PCB layout for the switch-mode HV PSU

I've posted a page describing the design of a HV PSU (High-Voltage Power Supply) that generates up to 220V from a 12V input. In addition to that, it also provides 2*Vout (so, up to 440V, for dekatrons), and two outputs for powering digital logic: 5V and 3.3V. The primary HV boost circuit reaches 88% efficiency when going from 12V to 185V at 55mA, with a 3% output ripple.

The version I'm posting online is not perfect, but works quite well in a number of my projects. I decided I'd rather publish it as it is now rather than keep it locked forever.

It is published as Open-Source Hardware, to be used however one likes. All source design files are provided. It's my way of paying back: I learned a lot from looking at other designs and by asking questions, so now it's time to give back.