Category Archives: hardware

Sonos music using external HD on Raspberry Pi

You can attach an external hard drive to a Raspberry Pi and then share music over Sonos. This works very well. Even though my hard drive is connected to the rPI via USB 2.0, the music streams fine, no stutters.

Right now I’m playing Jeff Buckley’s ‘Sketches for My Sweetheart The Drunk’ all over the house. “Vancouver” track is so awesome!

Technically this kind of storage sharing falls under the term Network Attached Storage (NAS). But, that seems like an overblown term for just sharing one disk. There are a lot of features on a full-blown NAS.

How does the RaspberryPI share the storage? By running a server called Samba. This is a set of open-source programs that run in Unix/Linux to provide file and print services compatible with Windows-based clients.

Spin down?
Currently I’m looking into how to enable spin down of the hard drive when idle. Necessary? Supposed to make HD last longer. I just want to reduce power usage. The whole point of a Raspberry Pi in this scenario.

Maybe this page, “Spin Down and Manage Hard Drive Power on Raspberry Pi”, will help.

Feb 1, 2015
hdparm and sd-idle did not work. trying SDPARM.
sudo blkid
/dev/sda1: LABEL=”USB B” UUID=”B23A8B373A8AF81D” TYPE=”ntfs” PARTUUID=”b75ac8d0-01″

sudo sdparm –flexible –command=stop /dev/sda1
/dev/sda1: ST325082 3AS

Feb 3, 2015
The spin down using sdparm is working fine.

Hardware Used

  • Raspberry Pi 2 (Canakit Ulitimate Starter Kit with WIFI)
  • Old USB hub from Staples
  • 3.5 inch 1 GB Hard drive
  • HexStar-3 3.5in External Hard drive enclosure

Technical details
I had a lot of grief getting it to work. Haven’t touched a Linux system in while.

Some articles of the many articles I found information on how to do this are in the links section below. Note that there isn’t one single approach to do this. And, it also depends on what OS your running on Raspberry PI. I’m running Raspbian which I installed via NOOBS; all included in the kit I purchased.

Other articles about this approach:

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Private P2P HSM, a network for optimal virtual storage

In “Hierarchical Storage Management, from drive to cloud” I wrote about the idea of applying HSM by using a central storage or Cloud model. Here I discuss the next stage, using Peer-to-peer technology to create private clouds. The central remote cloud services are then useful as the expensive slow end point of data migration.

Hierarchical storage management (HSM) is a system of using layers or tiers of storage resources to migrate files according to various criteria. Data would autmatically be migrated from RAM to Solid-State Drives, to disks, and finally to Tapes. This is an old technology, around since the 1970s, and primarily used at enterprise business. However, various forms of HSM have been used in consumer products, services, or at the OS level. One example is a new service such as Bitcasa.

P2P Synchronization
The use of P2P to synchronize storage to one’s own devices got a big boost with BitTorrent Sync (BTSync) created by BitTorrent. BTSync, though not a replacement for something like DropBox, offers an additional model to offset some limitations of cloud storage.

BTSync showed that Peer-to-peer (P2P) sync works and is useful. Could this approach be used as a base to provide not only synchronization but migration of files to different tiers? A peer-to-peer-hierarchical-storage-management (p2pHSM).

With this approach, the private storage hierarchy is a true cloud, a private network of storage resources. This private cloud could also be connected to traditional cloud storage vendors, like BitCasa or DropBox, creating a hierarchy of storage Clouds. A further optimization is for the private P2P HSM to arbitrate or bid with multiple external Cloud providers for best rates and other criteria.

Scenario 1
Your extended family and real friends provides many computing devices to the private cloud: smartphones, NAS, USB drives, STBs, vehicles, laptops, PCs, tablets, and so forth. Each of these devices has limited storage capacities and bandwidth limits.

The storage resources on each device allocate a percentage of storage and bandwidth to the private cloud. The storage is secure and private, and its content available via access control permissions (ACL). For example, children cannot access their parents content.

  1. Your walking outside wearing your head mounted device, like Google Glass, and a Hummingbird flies into view, you turn on Record and create a video.
  2. The video gets transmitted to your mobile device.
  3. Your device notes that you are running out of space and a P2P storage request is made to the network of devices available.
  4. A high-end mobile phone is found that has extra space on a memory card.
  5. The original mobile device sends the video to that device.
  6. A week later, no one is viewing that video anymore so the system migrates that video to other storage.
  7. The next level is the laptop since it has plenty of room and is faster.
  8. A month later the video is again migrated to the family PC which has plenty of free space.
  9. Two months later it is again migrated to the family’s external cloud storage service if the monetary rules configured allow it.

At every file migration, the system seeks the optimization of price, performance, access, security, and capacity. Only when the private cloud is approaching certain limits or for backup purposes is the top, slowest, and most expensive tier, the conventional Cloud, used.

Of course, the history of file sharing systems is full of controversy. Some would say that a private P2P adds to the problems, notwithstanding that there are already plenty of public P2P networks and massive file sharing already occurring. Some issues are:

  • Security
  • Privacy
  • Copyrights and fair use
  • DRM
  • Is data accessed at the “Migration Level”, or migrated back?


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Reusing computer system’s heat – Grey Energy?

Computer systems generate a lot of heat. There is great effort to remove that heat using passive or active systems (fans, pipes, etc). There are also many efforts to design cooler systems.

I wonder if this excess heat can also be reused. Somewhat like “grey water” systems reuse some types of water in a home. The amount available is huge. Imagine reusing the heat energy from Google server farms.

I won’t state that this is possible; invariably, such statements tend to be demolished after simple analysis, for example, the cost to capture and reuse the heat energy may be too high or have a low ratio. Anyway, just a thought.

Re-posted from on March 5, 2006.

June 21, 2013: So, I wasn’t far off. Some company is doing exactly this. “Iceotope plans to revolutionise the traditional data centre”, While transferring and re-using heat to power other devices.

July 17, 2013: An example of novel ideas being wrong is pedestrian generated electricity. I read one article a while back that described this ingenious idea of using pedestrians walking on a platform that would transform very small deformations into electricity. These could be put in stairs and other places. Well, an engineer analyzed this and found that the generated would have been minuscule, not worth doing.

April 20, 2014: Surprising material could play huge role in saving energy: Tin selenide is best at converting waste heat to electricity


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Sonos Wireless HIFI system setup

It was time to upgrade our home music system. The Sonos system met the requirements. At the store I compared Play:5 sound to a Bose system. The Bose sound seemed slightly better, at least with the demo music it was using, but appeared (at the store) to be an iPhone based system and I use an Android smartphone. Since I don’t listen to pop music, and excess bass, I picked the Sonos and don’t regret it.

Setup is easy
Installing was pretty easy. Connect a Sonos Bridge (a separate purchase) to the network, install the Sonos controller app on the smartphone, press a button on the bridge and then on the player. Now you can control the player. The app is not bad. (The current version 4.1 is awesome).

April 19, 2014: I just saw on news that Sonos is thinking of not requiring the Bridge component: Our Vision for Rock-Solid Wireless, Evolved.

Accessing a folder
So far so good. This is where the problems began. How to access my music on the Windows 7 PC? No matter what I tried, could not access a shared folder. Opened up firewalls, looked at ports, etc. Looked like router issues. Luckily I still had my old wifi router switch that I was using before FIOS was installed to replace cable. I connected that router to the new primary router using a Cascade configuration. I set the music folder on the PC Shared access and tried again. it worked! I can see the file folders now. Not really sure what really made it work. Now I have yet another tangle of wires.

So, what do I have now. I can control Sonos using my Samsung Note running the free Sonos app. The Sonos sounds great. The access to music is fast. In contrast, trying to access music folders using DLNA is torture using my networked Sony TV.

PC Controller won’t install
See solution below.

I tried installing the Sonos controller on Windows. At one step it asks that you press a button on a Sonos component on the network. I press the button on the Bridge, the software says, I found it, then it attempts to set up the connection. Finally, it says it did not find anything. Doh!

Before you get a Sonos check the network hardware compatibility. Unfortunately, the solution offered on this page makes no sense:
“A third party wireless access point is needed. Sonos Controller for iPhone or SONOS CONTROL that are wireless should be associated to this third party access point and not the Actiontec/Qwest.” Ok, how?

Things I tried:
– Connecting the PC directly to the bridge, then the bridge to the old router. Same problem.
– Turning off Windows firewall. Nope.
– Reinstall of controller. Nope.
– Firewall in the router. Tried once, and router ceased working. Had to reset it and configure my network. Yeech. Do non-computer literate people buy this stuff?

I did not try turning off the WIFI in the Actiontec router. I’m surprised Fios is installing this router that may have issues.

Do I return the system? One part of it doesn’t work, the PC software. I got used to the sound and the ease of access to music and radio. Pandora is awesome on this.

PC Controller install SOLVED!
Turns out the Sonos system was trying to use a second network adapter running on my PC, VirtualBox Host-Only Network. Once I disabled that, the Sonos controller installed. I found the solution here, Using a Sonos Desktop Controller with a VPN or VMware adapters.

If you have the Android app do you really even need the PC Sonos controller. Yes! The phone app is good but nothing competes with a large fast easy to use system.

Now I’m piqued, is there any way to associate the controller with a specific adapter? Why doesn’t this cause problems elsewhere? So, if I have to run my Ubuntu in VirtualBox I can’t also run my Sonos controller in the Windows PC?

Update: August 31, 2013: Strange I can now run Sonos controller on PC while running Ubuntu Linux in a Virtual Box. No network issues. Hmmm.

Laptop Controller install not solved
While the PC controller install now works, the install on a laptop that is connected to network via WIFI does not. I think I will try disabling the WIFI on the actiontec and just using the WIFI on the LinkSys router. Will update when I find out if this works.


  • Windows 7 64bit
  • router: Actiontec MI424WR
  • router: linksys WRT54GS
  • Sonos: Player:5
  • Sonos: Bridge


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Parallel Threaded Interpretation of Sequential Code

Here is another web page I’m moving to this blog for storage. I was elaborating an idea I had in 1989 about hardware architecture.

Parallel Threaded Interpretation of Sequential Code (May 1989)

Sequential code can be dramatically accelerated by the use of parallel processing where all “interruptions” of sequential execution into non-working code such as branches signal the execution of effected code in parallel on available processors.

In may of 1989 or earlier while reading some descriptions of a proposed stack processor, the Harris Semiconductor RTX 32P, I had an idea to make use of multiple processors in a system. The system I was reading about used two bits to indicate what type of branch to perform: “The RTX 32P has only one instruction format, shown in Figure 5.4. Every instruction contains a 9-bit opcode which is used as the page number for addressing microcode. It also contains a 2-bit program flow control field that invokes either an unconditional branch, a subroutine call, or a subroutine exit. In the case of either a subroutine call or unconditional branch, bits 2-22 are used to specify the high 21 bits of a 23-bit word-aligned target address. …. See Architecture of the RTX 32P

This is very powerful, almost branching for free:

“Wherever possible, the RTX 32P’s compiler compacts an opcode followed by a subroutine call, return, or jump into a single instruction. In those cases where such compaction is not possible, a NOP opcode is compiled with a call, jump, or return, or a jump to next in-line instruction is compiled with an opcode. Tail-end recursion elimination is performed by compressing a subroutine call followed by a subroutine return into a simple jump to the beginning of the subroutine that was to be called, saving the cost of the return that would otherwise be executed in the calling routine. ” — Philip Koopman


What I noticed was that one combination of bits, 11, were not being used:

So I thought, why not use that bit combination to indicate on what processor to execute the code? This thought led to other ideas and I was off thinking of how this could be used, with very fast communication and cache, like optical interconnects, to parallelize sequential code. In a nutshell, each processor would take over execution when a processor hit a branch or other interruption of linear code. That way all processors would be used to run sequential code.

In effect, each processor would be running in their own “thread”, queing results, and eventually ask for results to ‘fire’ actual computation, resolving data dependencies. I think I got sidetracked by being limited to a load/store stack architecture, so I had to resolve the direct manipulation of stack frames and so forth. Keep in mind that I had a little bit knowledge of what computer architecture was, very naive perhaps.

I didn’t solve many of the problems and didn’t continue with it. It was fun, but I thought: if this had any relevance it would be already in use in the industry, and what do I know about this subject? Also, I was doing this in the context of a Stack Processor architecture which commercially was not part of the mainstream (the JVM is a stack machine?). Note to read on this architecture approach see Stack Computers: The New Wave, by Philip J. Koopman, Jr.

Well, years later I read about new architectures coming out, such as the Sun Microsystem’s forthcoming chip codenamed Rock, where “Simultaneous Speculative Threading (SST)”, “speculative execution” or “scout threads” are utilized for high performance. See “Rock: A SPARC CMT Processor” by S. Chaudhry. (btw, the Rock chip project was cancelled by Oracle) Further, I also read that these ideas became projects in the academic research community.

Ok, so I may have been on to something.


  1. Stack machine
  3. Rock: A SPARC CMT Processor” by S. Chaudhry
  4. Stack Computers: The New Wave, by Philip J. Koopman, Jr.
  5. Architecture of the RTX 32P
  6. GreenArrays, Inc.’s Common Architecture
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Dedicating multiprocessors per OS structure

A few weeks ago something I’ve been thinking about for a while came back into my thoughts. What if instead of multithreading at the application level, we instead dedicate a chip of a multicore processor to a specific OS resource.

What kind of OS resource? I don’t know. Maybe four processors at ring zero, or at the IO subsystems. We could have application specific cores that are optimized for specific software tasks, just as the new graphic processors are used for APU.

I’m certainly not a system designer and the above is probably pure drivel. Like, how would context switching work and not slow everything down? However, there are possible reasons why perhaps its not.

  • Number of cores will keep growing.
  • GPUs will become more important and powerful.
  • Future applications will be distributed and require advanced resource handling, example, hierarchical robust device systems, like memory handling.
  • Thermal limitations will demand new forms of optimization.
  • AI and robotics applications will reach a tipping point and become ubiquitous, and even more performance will be demanded from computing systems

After thinking about this, I later started seeing articles on internet-on-a-chip, a new way of connecting multicores. Interesting.

Further reading

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Samsung Galaxy Note is not too big.

Just got the Note. The AT&T model differs from the prior European model, I believe. Previously I had an iPhone, probably could even be the original one. I think my iPhone was using cogs and gears, so slow. If I opened the map and started entering an address, by the time the screen would respond to the first character, I would stumble upon my destination or get there by stopping at every gas station along the way. Well, anyway.

Most reviews of the new Note carry on about the size. Yes, it is larger but not by that much. In fact, like monitors and flat screen TVs, its the trim (bevel) that makes them look larger. The Samsung Note’s screen size is just about right. If Apple came out with a five and a half inch smart phone all the pundits would be drooling and everyone buying; let’s see how cool this would look in the cafe!

If I put the phone in my shirt pocket only about half an inch sticks out at the top, and that part is the trim where the camera and AT&T logo are located. Highly nerdy looking, btw. It is not very pocketable. They could have made the Note even better by minimizing the top and bottom bevels.

So, since it is a cross between a phone and a pad, where and how do you carry the dam thing? Is it squinting into tiny little screens or “hey baby, I’m happy to see you in a square kind of way!”.

As to the phone’s worth? [After using it a few days? Great!]

Of course, the screen is great. A Netflix movie looks awesome. But, what noob would really watch many movies on a phone; what about cinematography, sound, and all that? Better for shorter stuff like Youtube videos. At least, currently, for my tastes.

Meah. I tried it once, it did not keep up with my strokes. Perhaps, there is a setting for it. I will probably use it if I can adjust that. I think the old Palm Pilot’s pen kept up with the strokes, so a dual-core 1.5GHz system should do better. [update: Tried it a few times. I selected the eraser. If you stroke too fast, the eraser circle disappears. Come on, really?]. I read somewhere that this lag is due to the Note’s processor having to do it all; until Android 4.0 the graphics chip is not really used to its fullest. Don’t know if that is true.

Apps and OS:
It works and looks pretty much like a Galaxy SII Skyrocket. I think they changed a few things and the Skyrocket seems a little smoother and less error prone. Like the soft keys, volume rocker, and sleep switch are just too sensitive on the Note. Maybe it will take getting used to the new form factor so that the hands don’t trigger unwanted actions.

Active Apps app
I was testing the Navigator GPS app that has voice prompting and all that. Then I had to leave on an errand to a different location. The app just kept telling me “turn here, turn here you idiot; your going the wrong way!” Very annoying. I couldn’t stop it.

So, I clicked on the app for active apps, the navigator did not show in the list, huh? Its speaking, knows where I should be going, not where I want to go. So I just dragged the top of the home screen down (nice Android feature) to list the app, opened it, got to its menu, and exited it. In the meantime I almost went off the highway. Yea, don’t drink or mobile while driving, especially with a Note that needs two hands, and a Padma Mayurasana to manipulate. Maybe these things should except an overriding voice input: “shut up!”. Not you honey, this thing that is always so happy to see you.

Feb 21, 2012:
Headphone does not mute speaker volume?
Was using the Note at work today. Had the headphones on. People looked at me like I’m a nut. Turns out the Note was ringing all over the place. I thought my tinkering with the ringtones was just in my earphones. What is up with that? I don’t remember if the iPhone automatically muted the speaker when the headphone was connected. In both, of course, the music, like Pandora was still going through the headphone. Someone told me I first have to reduce the volume so that the ringer is off, then plug in the headphone. Seems convoluted. [that did not work. If you mute the ringer, then only the media volume is working.]

When I Receive A Call, The Ringtone Is Not Heard Through The Hands Free Headset. Is There A Setting To Turn It On?

There are no configurable options or settings available to turn on the ability to hear the ringtones through the headset, they are heard through the handset itself, only. This is a matter of safety, as the decibel level for a normal call is much lower than that of a ringtone. Due to the decibel level of a ringtone being much louder than the human voice, the ringtones are not audible through the headset to protect against possible hearing loss.

That sounds like a lame excuse. If the handset can detect that a headphone plug was inserted or removed it can reduce the ringer volume to a subset of the media volume. Or should, but what do I know?
Blanking of the screen:
The “normal” settings for blanking don’t stop the screen from blanking so quickly. Turns out that is a setting in the custom power saving mode. Maybe it is elsewhere and I missed it.

Good reviews on youtube:

Further Reading

  1. On Wikipedia
  2. Samsung Galaxy Note Top Tips Collection
  3. Download Android app, give away your body, mind and soul?
  4. Samsung Galaxy Note page
  5. Samsung Galaxy Note: Unboxing, size comparison to Galaxy S II

  6. The Samsung Galaxy Note Vs Galaxy S II Vs Pockets Showdown / “Pocketability” demo!
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Windows 8 Storage Spaces?

Finally Windows may get a file system that adds features that have been around for years in Linux and Unix.

The state of the art in file system design could arguably be ZFS which is used in Solaris and a few other places.

Storage systems seem like very complex engineering systems. I wonder if Microsoft would have just been better off not reinventing the wheel and just licensing ZFS technology or something else? Just search for user horror stories regarding any of the storage improvements on Windows, from drive extender, encryption, WHS, etc.

And what ever happened to the object file system, the DB based file system?

Storage Spaces is somewhat like ZFS, although it has no deduplication and lacks other ZFS features. However, it is a start – and Microsoft will probably add features such as snapshots, replication, deduplication, and, maybe, compression. El Reg also thinks that there could be a Hyper-V virtualisation angle to this – and more is to come. —

Jan 17, 2012: Ah, so Microsoft is working Resilient File System (ReFS).

Microsoft mentioned all the important keywords when promoting ReFS with words like resilience, availability and the use of storage pools, something made popular by Sun’s – and now Oracle’s – ZFS.
Source: The Inquirer (

Further Reading

VOWS “Winter’s Grave” OFFICIAL video

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

State Machine discord as system error detection

It takes three subsystem state machines to create an error adaptive system.

This morning in the shower I was thinking about my last post on SCXML. What do you use as states in a system? Easy question, but then I thought, sure its internal states of a process, but how does the external “real” come into the picture, via guards? That could get messy in a very complex real world system. So, what if the external system is also modeled as a state machine?

Now we have two state machines, internal system and external system. What is the advantage? Well, each can have a peak into the other or using historical information, compute how the other works. Then if this prediction is not matched, it is an error. That is, if the internal machine is at state x and it knows that the external machine should be at state y at this point, and it is not, it is a system error. What to do?

This is where a third error machine would come into use. The function of this machine is to bring the other two into resonance, reduce the entropy, heat.

Depending on whether the machines are Mealy or Moore based, one would detect errors at particular points, events, transitions, or states.

I remember reading years ago about fault tolerant hardware systems. The minimum components was three; similar.

Hmmm. I don’t know what everything above really means, if anything. πŸ™‚

Tangential subject: State machines, life cycles, etc:

For future thinking …

  • How does a FSM approach differ from a REST architecture.
    Building a RESTful Hypermedia Agent, Part 1
  • On the finite-state machine, a minimal model of mousetraps, ribosomes and the human soul“, Brian Hayes, Scientific American, 1983. Accessed November 6, 2011, at
  • “Exception Handling Mechanism in Communicating Threads for Java”, Gerald. H. HILDERINK, Communicating Process Architectures 2005;
    Jan Broenink, Herman Roebbers, Johan Sunter, Peter Welch, and David Wood (Eds.), IOS Press, 2005
  • “Self-Healing in Modern Operating Systems”, Michael W. Shapiro, Sun Microsystems, QUEUE December/January 2004-2005.


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

External HD enclosure with SATA to eSATA

Finally switched my external HD enclosure from external USB to the included eSATA hardware.

It worked! I didn’t measure performance, but I clicked on the drive and the explorer window popped up quick, not like the usual USB drive. Then I did a check disk (w/fix) on it. Wow! How fast.

RoseWill RX358-S SLV, a single disk enclosure, comes with support for SATA to eSATA interface. What’s nice is that comes with the hardware, bracket and the cable. Just had to plug the internal cable to a SATA plug on the PC motherboard. No drivers or software to install.

Interesting, I thought that SATA and eSATA were incompatible; the hardware is just a connector adapter.

Now if Windows 7’s backup software were not so inscrutable. Not sure if differential really works, see. The 1TB drive already has only 314GB free after only two backups!


  1. RoseWill RX358-S SLV
  2. Sold on

— HP P6230Y
— AMD Phenom II X4 810/2.6 Ghz
— Windows 7 Professional
— HIS HD 5670 IceQ 1GB (128bit) GDDR5 PCIe Display Port (DirectX 11/ Eyefinity)
— Samsung SyncMaster P2350
— Acer P241w

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.