Wednesday, December 16, 2015

C.H.I.P. vs Raspberry Pi Zero

The single board computer market is one that exploded when the Raspberry Pi foundation created the first Raspberry Pi in 2012. Since then, the market has made large strides, not the least of which was once again introduced by a Raspberry, this time the Raspberry 2, which kept the same price as the original but vastly improved the hardware.

The latest development, though, seems to be in a different direction. This time we're getting even cheaper computers. Those cheaper computer may not have the same capabilities, but they are actually competing at the price space below $10. This time, though, it seems Raspberry wasn't the one to drive the new development, Next Thing Corp was the one to do so with their C.H.I.P. However, Raspberry quickly reacted and actually brought their competing computer to the market before the C.H.I.P. arrived (sort of).

It's definitely time to compare the two. Before I start, though, let me say that I like both. I have poured a decent amount of money into orders for the C.H.I.P. and I will be getting the Pi Zero once it is properly available. Discussions about these two often involve fans of both brands and then someone more levelheaded who remarks that both have their own uses and any comparison done is skewed. I like to think that I am rather levelheaded myself. However, I just see one computer being better for practically all the use cases. Well, there's probably some more obscure cases that the other does better at, but the majority of the use cases is handled better by just one of the two competing computers. Still, I do like both and I'm glad to see this new territory of the <$10 computer being explored.

Now, let's get to the comparing:

Raspberry Pi Zero C.H.I.P.
Processor Broadcom BCM2835 Allwinner A8
Processor clock speed 1 GHz 1 GHz
Processor architecture ARMv6 ARMv7
RAM 512MB LPDDR2 512MB DDR3
Storage Mirco-SD Slot 4 GB eMMC
Video Connector mini-HDMI 3.5mm Composite
Alternate Video Connections Composite over GPIO VGA or HDMI through add-on boards
Audio Connector through HDMI through 3.5mm video jack
Power Connection Micro-USB Micro-USB and battery connector
Other wired connections Micro-USB OTG USB (or use Power connector as USB OTG)
Wireless connections None Wifi (2.4 GHz only), Bluetooth 4.0
Price $5 (excl. storage) $9 (incl. storage)

The Processor

The two computers start off surprisingly similar. Both computers have a rather comparable processor. Though the C.H.I.P. has a slightly more recent architecture, the difference really shouldn't be too big.

RAM

For RAM, the choices are once again not exactly the same, but still quite comparable. The LDDR2 of the Pi Zero is somewhat more energy efficient, while the DDR3 of the C.H.I.P. is somewhat faster.

Storage

With the very basics out of the way, the more interesting differences in choices start coming up. Following in the footsteps of the other Raspberries, the Zero has a micro-SD slot. This has the advantages that you can decide on the amount of storage you want yourself as you buy your micro-SD card and it also allows you to run several different setups on different cards and swap them in and out as you want. It also means that the initial setup will require an external computer with a micro-SD card reader.

The C.H.I.P. took the approach of built-in memory instead. This has the advantages that you can run the system out of the box and that it tends to be more reliable than removable storage. It also means that you cannot decide the amount of storage space yourself and you'll have to rely USB-storage if the provided 4 GB isn't enough.

Video Connectors

The video out connections are another point where the two systems took a radically different course. The Pi Zero gives you HDMI out of the box. If you want composite instead, you can use GPIO, but it'll be necessary to do some soldering for that.

The C.H.I.P., on the other hand, gives you composite video out of the box (using a 3.5mm connector, the same as the composite connection on the Raspberry Pi 2B) and has extension boards for both VGA and HDMI. The extension boards are quite expensive (I definitely hope we'll be getting cheaper Chinese copies, but that's not the current situation) and you'll quite often need the HDMI one. It's also quite nice that the C.H.I.P. supports VGA (unlike the Zero) even though it won't be a main use case in most situations.

Audio Connectors

Both computers have their audio output on the same connector as the video. However, because the video connections are quite different, this means quite different things for the different systems. The Raspberry has its audio on the HDMI port, which means there is support for many channels. However, this is also means that it will be challenging to separate the video and audio if you want to have separate connectors.

The C.H.I.P. has its disadvantages reversed, it does not support more than two channels, but it has completely separate signals for video and audio (though on the same connector) so it's trivial to separate the two. Hopefully the HDMI extension board will also include audio over HDMI, making the CHIP able to invert its advantages and disadvantages, but this is not something I know about at this moment.

Power

Both the C.H.I.P. and the Raspberry Pi Zero can be powered through a micro-usb port. However, the C.H.I.P. has a second option: it can also be powered through its dedicated battery connector. The connector is a bit more than just a power connector, though, as support for the battery is built in, meaning it can also charge the battery using the power from the micro-usb port. You could even use the battery as a UPS for the C.H.I.P. For the Zero, you can probably achieve a similar setup using an external powerbank with two connections, but this is likely to be less flexible, more expensive and in the end not as reliable.

Other wired connections

The Pi Zero has a micro-usb OTG slot and that's it. This is the second of its micro-usb ports and is completely separate from its power micro-usb port. In fact, its power micro-usb port can actually not be used as a second USB port (of course, it wouldn't make much sense anyway, as you wouldn't be able to power the system and use both ports at the same time).

The C.H.I.P. has a normal USB port instead. This eliminates the micro-USB to USB connector that you will practically always need (in my opinion) for the Zero. Additionally, the power connector can be used as a second USB OTG port. In this case, you will have to power your computer in a different way, but the C.H.I.P. has its battery connector which allows for exactly that.

Wireless connections

The Pi Zero has none, which means it all comes down to its one usb port. The C.H.I.P. on the other hand, has both Wifi and Bluetooth support. The wifi covers another very major point of functionality in my opinion. It may only support 2.4 GHz, but for most applications that should be quite enough. The Bluetooth support does not quite have the same effect, but it will be able to offload some of the work from the USB port. On top of that, I would consider it a bonus, as it can be used to communicate with any other Bluetooth "client" devices you may happen to have and if that takes your fancy you could even use bluetooth for a headless setup instead of (or alongside) Wifi.

Price

The C.H.I.P. advertises with the slogan "the world's first $9 computer". However, the Zero actually came and beat that price point, costing only $5. However, I'd say they actually cost about the same in reality, as the Pi still requires you to buy a micro-SD card before it does anything at all. The price of such a card may not be set in stone (and may differ depending on quality and size) but at least now the difference in price isn't truly significant anymore.

Availability

At the moment, I can't buy either the Pi Zero or the C.H.I.P. Some people have a Pi Zero, but it's now sold out. However, they do not have a huge back-order and there are people who own one of these. For the C.H.I.P., the only models out there are the alpha versions. They did a kickstarter and pre-orders, so they have our money and the back-order that goes with it. Without any models out there, there is always a slight doubt that we'll get what we were promised. As such, the Pi Zero is the one that delivers slightly better here. At the end of the day, though, I can't actually get either right now.

Name

There's one more thing that I do have to mention, which is the name. A good name can be googled. However, that isn't very hard these days and I have actually seen several name changes that listed a better googleability as a major driver for the change and all of those were rather misguided in my opinion. That said, C.H.I.P. is just a horrible name to search for. It doesn't only have a different meaning, but that other meaning is actually in the same field, so most terms you could add to your search query actually won't help (e.g. "chip computer"). I've currently settled on searching for "chip ntc" but this only works well on google (not, for example, a webshop's own search) and even then I doubt I'll be getting all the results (i.e. accuracy is good, recall might not be).

Raspberry Pi Zero is of course a fine name and there isn't much to say about it. It uses the established raspberry name, which makes searching easier (e.g. "pi zero" will yield quite good results). The only other thing I could say about this is that "Raspberry Pi Zero 2" may sound a bit strange, but really that's just getting ahead of ourselves..

Extra's

Finally, there's the extra's. Of course, this isn't much of a point, but I still wanted to mention that personally I quite like the pocketCHIP. Besides looking like an old gameboy somewhat (and allowing you to play games on it almost like it is one) it also gives you the option to just pop in my headless server, do some maintenance (or even the initial setup) and then pop it out again. I just like the idea of that, even if I haven't had the chance to try it out yet. Of course, the pocketCHIP is well outside the price range that characterizes these two computers.

Desktop without internet access

As I mentioned before, people often state that the Pi Zero and C.H.I.P. have different use cases. I don't see it. To explain why I don't, I'll go over what I would consider the main use cases for either computer and look at the hardware that will be required on top of the computer (and in case of the Pi, I'll count the micro-SD card as part of this "computer"). The first use case is a desktop system without internet access. Though I really think you'll generally want to have internet, this case would appear to be one of the better ones for the Zero, so I decided to include it anyway.

For a desktop system, I'll assume you need HDMI for the monitor, and both a mouse and a keyboard.

The Pi Zero will require the micro-USB to USB cable that you will practically always need for it. Then, you will also need either a usb bluetooth connector and keyboard and mouse on bluetooth, or a usb hub and a keyboard and mouse connected through usb. Having one of your two input devices on bluetooth and the other on USB requires even more additional hardware, so I won't even look at that option. So:
  • Micro-USB to USB
  • USB Bluetooth
  • Bluetooth Mouse
  • Bluetooth Keyboard
Or:
  • Micro-USB to USB
  • USB Hub
  • USB Mouse
  • USB Keyboard
The C.H.I.P can free up a usb slot by using Bluetooth, meaning you won't need the hub. It will need the HDMI connector board in order to connect to our monitor.
  • HDMI Board
  • USB / Bluetooth mouse (only one of the mouse and keyboard can use USB)
  • USB / Bluetooth keyboard (only one of the mouse and keyboard can use USB)
If you really want to have both mouse and keyboard on usb, you will have to go with this instead:
  • HDMI Board
  • USB Hub
  • USB mouse
  • USB keyboard
My verdict here would be that if you want a desktop without internet and are set on having a usb mouse and keyboard, the Pi Zero wins (though not by much). In any other (desktop without internet) case, the C.H.I.P. is the better choice. Of course, when your monitor has a VGA connection or even composite, the Zero is left in the dust completely.

Desktop with internet

This case is similar to the one above for the C.H.I.P. as it has built-in wifi. The Pi will need to use a USB port for the internet, so that will be added as well as making the usb hub no longer optional:
  • Micro-USB to USB
  • USB Hub
  • USB Wifi / USB Ethernet
  • USB / Bluetooth Mouse
  • USB / Bluetooth Keyboard
  • USB Bluetooth if either the Mouse or Keyboard uses Bluetooth
C.H.I.P.:
  • HDMI Board
  • USB / Bluetooth mouse (only one of the mouse and keyboard can use USB)
  • USB / Bluetooth keyboard (only one of the mouse and keyboard can use USB)
If you really want to have both mouse and keyboard over usb, or really want to have wired internet, the following springs to mind for the C.H.I.P.:
  • HDMI Board
  • USB Ethernet
  • Bluetooth mouse
  • Bluetooth keyboard
You could of course want one (or both) of your input devices on USB while wanting a wired connection, or you could want both input devices over USB:
  • HDMI Board
  • USB Hub
  • USB Ethernet (if wired connection is required)
  • USB / Bluetooth mouse
  • USB / Bluetooth keyboard
Once again, the C.H.I.P. seems to take the lead in most cases. Only if you must have wired internet and do not want your mouse and keyboard to use Bluetooth, the Pi gets out ahead. In other cases, the C.H.I.P. wins yet again.

Headless server

Let's start with the Pi:
  • Micro-USB to USB
  • USB Wifi / USB Ethernet
And then the C.H.I.P.:
  •  ... eh, none.
Yes, that's right, this is what the C.H.I.P. excels at. It doesn't need anything. That makes it the clear winner here in my book. If you really want to have a wired connection, the C.H.I.P. also needs a USB Ethernet adapter, making the only difference with the Pi the Micro-USB cable, but then the Pi may be only slightly behind, but behind is behind.

Headless mobile devices

Imagine making a robot. Would you rather use the Pi Zero as its brain or the C.H.I.P.?

The case is very much the same as the headless server above (forgetting about the wired connection part, as that's not an option), so the C.H.I.P. is already ahead. Then we need to add a battery. There the C.H.I.P. can either use its battery connector or use a custom micro-usb based solution, while the Zero has only the latter option. As such, the C.H.I.P. gains even more and is the undisputed winner in this category.

Conclusion

To me, the C.H.I.P. is the clear winner. There may still be some use cases I haven't talked about (e.g. wired or wireless devices with a touchscreen) but as we look at those, we are getting further and further into niche territory. And honestly, I think C.H.I.P. will still do pretty good there. And sure, there will be some cases where the Pi Zero is obviously the better choice, but for the overwhelming majority of the cases, I think the C.H.I.P. is in fact the better of the two.

Let me close by repeating something I've said before: I like both. I like that this low budget segment is being explored. I'll get both boards. However, to me, it's very clear that the C.H.I.P. is the better choice.

Friday, April 24, 2015

Agent Carter: The One-Time Pad

I recently decided to watch Agent Carter. Sure, the reason I got into the Marvel Cinematic Universe was the simple fact that Joss Whedon was creating a show set in it, but by now I have become invested in the entire MCU and watching a non-Whedon show set in the universe was the logical next step.
Agent Carter started off pretty good, but today I watched an episode that made me ragequit the series. It was episode 5 (The Iron Ceiling) in which the main characters received an encoded message that wasn't meant for them. Their cryptographer couldn't handle it, so Carter came to the rescue. She mentions it's a one-time pad, says that the puzzle piece the cartographer was missing was that the original message was in Russian. And then, she continues to break the encryption in under 20 seconds.

WAIT. What? That's NOT how a one-time pad works!

A one-time pad is the one method of cryptography that is unbreakable. In fact, it's been proved mathematically that it is impossible to break. Actually, if you know how a one-time pad works, you should be able to come to that same conclusion.

The one-time pad may be unbreakable, but it has some other properties that are the cause for it not really being used in the digital world. Personally I quite like the one-time pad, so perhaps I will write about it in more depth some other time. I like to think about how it can be used in this day and age or even in the future. For example, I'd use it if I were in professional espionage even today. I've also thought of a very good way to use it in a futuristic galactic empire, where it would be especially important because the technology of another empire might be very far ahead of your own.

Another thing I like to think about is the limitations of the system. One of the problems is that you have to keep your "pad" or cryptographical key secret, which is a challenge after you die. Technology can help there, but technology wasn't around during the days of Agent Carter. You would have to keep the key either on you or store it in a safe place. Considering that, it really isn't that much of a stretch it was somewhere in the apartment where they also found the typewriter on which they received the message. Not the smartest move to keep them together, but an easy mistake to make, really.

One of the advantages of tv series is that after rageplugging you can just later pick up where you left once you've cooled down. It had never been mentioned or seen on screen, but both Carter and the cryptographer must have had the pad, which had been retrieved from the original owner's apartment. It's a bit of a stretch I needed to add to make sense of things, but I'm willing to do that. Unlike someone truly breaking a one-time pad message like that, it's not outside my realm of suspension of disbelieve.

As a final note, I did google "Agent Carter one-time pad", expecting to find other people ranting about this same thing. I was a little let down to find less than a handful of people were complaining about this. The one-time pad is really one of the most basic things of encryption and honestly, I feel that every computer scientist should know at least a little about encryption. I'll just choose to believe that very few computer scientists have seen the episode. However, one of the posts in question mentioned a solution similar to mine, but dismissed it because the cryptographer should have recognized the Cyrillic alphabet. The thing that counters this, though, is that the one-time pad can take many forms. It is often explained in a simple form that uses alphabetical operations, but - for example - in the digital age those operations for a simple bitwise XOR makes a lot of sense, because it would allow encryption of any type of data. Likewise, there are definitely variants that hide the fact that the message was in Russian and in fact using one of those makes a lot of sense if your intended receiver is (or was) doing espionage in the United States...