Energy Monitoring

It’s been a long time since I’ve posted on my energy monitoring. It’s taken a fair bit of updating but it’s now stable and working well. I am using an emonTx to monitor the energy being used at my rental building and at my place.  The two current CT’s measure each side of the 240 volt system and I get a graph that updates every 5 seconds.

Screen Shot 2014-01-07 at 6.29.45 PM

I’m also using it to monitor the temperature and by placing one in a vent near my furnace I can see when ever it comes on. I was originally logging the Temps to COSM, or Pachube or what ever they call themScreen Shot 2014-01-07 at 6.30.11 PMself now, but I’m now centralizing my data to my own emonCMS server. The group at does a great job of keeping it pretty up to date. I then use Prowl to have alerts (temp falls too low) sent to my iPhone.



In my living room I have an emonLCD which display my current power usage and logs my room temperature. It’s one of those things that you walk by all the time during the day and ignore, but when you glance at it, I’m reminded to watch my energy consumption. It’s a nice subtle way of training my awareness and behavior.

Posted in Electronic Tinkering | Leave a comment

Debt – The First 5000 Years


This is my current read. To be honest, I bought it because it was on sale on Amazon, I’m interested in the history and because it was rated quite high. So far it’s an excellent find.

This book is reshaping how I think about finance, money, and debt. I’ve always been fascinated the the arcane way ‘money’ is created in our reserve banking system. It seems crazy that our banks create ‘government debt’ before they create money. If we want more money in our system, we create more government debt first. This seems a crazy way to run a banking system. And it explains why governments will always be in debt.

But David Graeber argues that it’s not just governments what have created money this way. David argues that historically debt existed before money. His enquiry starts of when he is describing his work with the a social justice organization in favour of cancelling the developing nations (formerly the Third World) debt. At this dinner party, his guest makes the comment well, “all debts must be repaid, don’t they?”. David realized that this is a moral question not an economic question. For indeed from an economic standby the opposite is true – many debts cannot, should not and will not be repaid. That is why bankruptcy laws exist and that is why investors get paid a ‘risk premium’ in the form of ‘interest’. If Debts were literally always repaid, economic theory would imply interest rates would basically be zero.

Further, David explores that fact that morality and economics have always been intertwined. Biblical terms like ‘redemption’ and  ‘reckoning’ are ancient financial terms. Religion and morality and finance are tightly woven together (and by extrapolation our breakdown in our understanding of morality now has broken our financial world as well).

Key to understanding that morality and money are so tired, is understanding the myth of our money creation. Adam Smith and pretty much every economic textbook starts by describing how we arrived at money and then debt. It’s a story about how we were first hunters and gathers that forged for our basic needs. When we learnt that we could specialize in say “arrow making” or “tent sewing” we learnt to barter on good for another. The barter world has a problem that economics is known as the ‘double coincidence’ problem. Simply put, this means that if I make arrows and you have meat, for us trade, by coincidence you must happen to want arrows and I must happen to want meat. But what if you prefer a spear or I have too much meat already? We simply can’t trade. So currency was created to facilitate trade.

It’s a beautiful story that creates the myth that currency is simply a tool of exchange used to facilitate and easier exchange of production. The problem as Mr Graeber’s anthopolists see it, is that no such society existed. In no time or place has such a barter community existed. In fact, it appears that credit and therefore debt was created well before money. Which makes sense when you think back to basics of imagining “well, you can have my spear but you owe me one”.

Debt was nearly always a government function to facilitate war. Picture in medieval times trying to raise an army of 1000 men. These men would normally have employed raising food for themselves. You would need nearly another 1000 men working to provide the army with food. So how do you entice men to raise food for themself plus another man. The answer was to create a currency (a token) to pay the man for his food, but then require him to pay another in tax. With taxes came debt in the effort to feed an army.

It is the very close and strong relationship between debt and violence that has lead religious record to speak very often and very strong about this topic. In some religions borrowing money was a sin, while in others to lend was a sin. In either case the moral lessons of forgiveness and generosity as opposed to strict enforcement applied. This was not because religious doesn’t believe a debt shouldn’t be repaid, it is because a debt is likely already repaid.

How Debt and Money are created is the centre issue of politics. Governments have always had a monopoly of deciding how money is created, and therefore on how much debt we are ‘born with’.  This has changed at different times, resulting in different values to different people.

The Wizard of Oz (oz being the abbreviation for ounce, as in an ounce of gold) was written at the turn of the last century as a warning or message to the different parties. The straw man with no brain was the farmers, the tin man with no heart was industry who didn’t support the plight of the farmers from “wicked witch of the west” which was the east and west coast bankers. The lion without courage was the political elite.

Interestingly the author notes that currencies were not first used for trade. In most tribes or clans, tools and food were provided communally. Currencies were used for ceremonial goods, in essence, buying status. The items that became currency were themselves items that were sought after for status. Cattle being the notable exception but gold, silver, shells, pearls, inks, etc all have not true value aside from the decoration of self. This leads back to the concept of honor since that is basically what was being bought with these goods. In fact, some societies outlined this very explicitly. In ancient Ireland, large tables layout the value of honour. Dishonoring a King was six cattle, a nobleman 3, and so on. If you injured another man, you were ‘in debt’ for the cost of his honour, plus the cost of the injury which was all pre-calculated. Honour becomes a strange concept when we consider that honour is tightly tied with debt – “debt of honour”, “honour one’s debt”, etc. The oldest traces of financial debt we have are all tied in with honour. This becomes more telling when we consider that honour is a concept used mostly in violent society. Even now, talk of “maintaining the family honour” or a “code of honour” usually ends in violence. Honour can defined in this way as excessive dignity.

The book takes a look into the darkest corners of debt. The sale of women in history, and the slave trade. Interstingly, while debts were occasionally listed in ‘women’, debts were not usually settled in women. In fact in some cultures it appears that by listing a debt in women, the debt was simply made unpayable. In some places it was understood that the only thing that could ‘buy’ a woman (for marriage) was another woman. Sisters were often traded between clans. When one clan didn’t yet have a suitable woman to trade for marriage, it was acknowledged that a ‘debt’ was owed. Often cattle were traded here, but not in the manner of cattle for a woman, but in the manner of ‘interest’ to acknowledge that a debt was still owed to the other clan. In cases where women were actually traded or bought, it was typically where the woman was “acquired” through pillage and war. To commoditize a human man or woman, means to violently rip them from their community. A human becomes a fungible good through violence.

The scary thing about the slave trade was that it wasn’t the violent immoral act we imagine it was. It was something much worse. While white slave traders occasionally roamed the jungle and kidnap and imprison Africans, the industry itself became much more insidious. A local trader in Africa would borrow money from a merchant against a load of slaves that he not yet acquired. As collateral he would often provide his family until he returned with his ‘wares’. This trader would then make contact with other tribes and similar credit swapping arrangements would follow. This type arrangement would continue in till eventually in some tribe, some one was judged in default of his debts, and thus traded up the ladder until eventually some one was put on a boat bound for a Caribbean plantation. Loans and debts were used to ‘legitimize’ what was simply an act of pillage.

Posted in Reading | Leave a comment

Talent is Overrated

TalentIsOverRatedThis book describes what makes a person excel at his or her field. Many of the studies referenced in this book are the same ones illustrated in “Outliers” by Malcolm Gladwell.

While the underlying lesson is the same, the book goes far more in depth and is worth the read.

Some lessons to note:

  1. No Talent is innate. Talent is the result of massive amounts of hard work. This is the 10,000 hour (10 year) rule in “Outliers”. The Beatles, Tiger Woods, Beethoven, etc all were mediocre before they put in the work needed to become exceptional.
  2. Practice isn’t good enough. It takes “Deliberate Practice”. This is a unique type of practice that is actually painful. Even experts at a field can only do it for small periods of time before need a break or even a nap. In the examples used, it becomes clear that going to the driving range every day to hit balls isn’t Deliberate Practice. Deliberate Practice is where you study a skill, break it down to it’s parts, and study each part carefully over and over again. Unlike say ‘learning to drive’ the object of deliberate practice isn’t to make an action automatic. The best example he give is how Tiger Woods can pull his shot mid-stroke if he becomes distracted, while lessor golfers – although good – can’t. A shot is never automatic to Tiger Woods, it is always the result of extreme concentration and effort.
  3. Deliberate Practice involves doing the things you are bad at, not the things you are good at.  This is a major difference between the way some people practice and they way experts practice.
  4. There is an edge where learning occurs. It must be hard enough to challenge us, yet not so hard that we are discouraged. This is a hard balance to find.
  5. Institutions are terrible at developing talent since, for example, the work place rarely forces a person to the edge of their skill level. Work places typically value routine more than learning requires.
  6. Some institutions are working hard to develop people. According to the book, GE has way more capital than it can use. Dividends are a companies way of saying “here –  you know what to do with this money better than we do”. GE is quoted as saying they simply do not have the people (talent) necessary to fully utilize capital.
  7. Starting young is necessary to be a master at things that young people can start to learn. Golf, music, etc are all skills that even very very young children can start to practice at. When we age, even the brains of experts slow down, however this often doesn’t show – experts adapt by using different routines, shortcuts, knowledge to stay atop their field.
  8. Motivation is key. The biggest obstacle to talent is the very painful learning that has to go in. What makes some people stick it out? One theory is that small advantages in an area make a person stand out early in that area. They then acquire praise for their skill in that area, which makes them want to be better at it. They do and therefor become more skilled for more praise, etc. It’s a virtuosos cycle. Experts often come from small circles (towns, small schools, outlying areas, etc) since it’s easier to stand out in a small group. This leads to the motivation, which leads to the talent, etc.
  9. The cycle described above can started by ‘false praise’ which leads to motivation, which leads to talent, etc.
  10. The last point I can remember is that memory is purely a learned skill – which obviously I need to work on since I can barely remember 10 clear points from such an excellent book.
Posted in Reading | Leave a comment

Reckless Endangerment

RecklessEndangermentThis book is an amazing look at the corruption that allowed Fannie May and Freddie Mac to decimate the economy. Both companies ran massive lobbies that promoted ‘community and housing’ something that no politician could vote against. In the meantime they created a network of offices around the US that didn’t offer mortgages as a mortgage company should, but instead served as local lobbying and patronage centres.  Fannie and Freddy lobbied tirelessly to prevent privatization knowing they enjoyed a huge government perk (the unwritten government loan backstop). In return Freddy and Fannie shared a tiny tiny share of that benefit with their customers and used the rest to pad shareholders and managements pockets.  This book provides a very real and readable warning about the power large companies have over government and the disastrous danger that presents to society. The sad part is that academics, some bankers, and some honest lawmakers could see the hazards that these companies posed and yet were powerless to stop them.

Posted in Reading | Leave a comment

Grouse Mountain Plane Crash Hike

This past weekend I was in Vancouver for work. We had the day free so my co-workers and I decided to do the Grouse Grind. The Grouse Grind is a Vancouver hike that basically goes straight up grouse mountain. Although it’s technically a hiking trail, it feels like a 2 mile staircase!

We were talking about walking down as well (the usual route being the Tram). I’d read there was a plane crash on the mountain back in the 1950’s so I suggested we we try and find that on the way down.Unsaved Preview Document

The first part of the hike down is down the clearing under a ski lift so that was pretty easy. From there the trail splits and becomes mostly a creek bed. The Lat/Long that I had loaded in my phone took us pretty much straight there.

There really isn’t much wreckage left. Some news stories say that the wreckage was taken back to the US for investigation, while some says that it was buried on site. The only remaining part that we found was the engine. The titanium parts were in remarkably good shape with very little corrosion.


In 2006 a legion in Vancouver set up a plaque and memorial to the pilot. They even invited the Widow and Daughter of the pilot to the unveiling ceremony.

The plane itself was an F-86 Sabre being flow on a training mission from McChord Air Force Base in Tacoma, Washington. The pilot reported a compass failure and eventually declared a Mayday when he became lost and low on fuel. He was attempting to land at Vancouver being vectored by controllers back in the US when he crashed.

It seems strange that a US jet could enter Canadian airspace (armed with 24 rockets) without much notice from the Canadian government.

Mail AttachmentWhen the plane was reported crashed, the US government appealed to Canadians for reports of it’s location and it was located within a day or so. The US military then handled the cleanup and recovery.

F-86 EngineThere isn’t much left of the wreckage. The engine is largely intact but that is all that is left. I suspect that the rest of the wreckage was carried out in the 50’s but the engine would have been to heavy to move. The titanium compressor blades, although bent, are in great shape considering their age. It’s well worth the hike!

This is the first crash site I’ve found but there are number of other sites in Canada that I plan to visit when time permits.

Posted in Adventure | 2 Comments

Pyranometer Project

The next part of my home energy system is to measure the solar energy available. I want to be able to determine how much sunlight I get on a daily or weekly basis. This will allow me to plan or at least cost out either solar PV cells or solar air heating.

I planned to use a photodiode to measure the energy created, but then discovered that the way to do it is to reverse bias the diode and measure the tiny current being create. This current is directly proportional to the luminance. The best reference I found was this so I ordered a few of the diodes mentioned and set to work.

The first problem is that the Arduino has a 10 bit Analog to Digital converter (ADC) which according to the research is a little too course to accurately measure the energy produced. The next issue I saw coming was line loss. I want the sensor outside in the sun, but I don’t want to move my Arduino out there since I need to have internet access to log the data. This means I’ll need to convert the signal to Digital at the sensor so I can transmit it back along my line to the Arduino. I have been using the Maxim 1-wire protocol for the temperature sensors, so I figured I’d try to use that as well. The problem is Maxim doesn’t make a 12 bit 1-wire ADC. When I wrote to ask if they had one in the works, they told me they don’t since they don’t feel there is the demand. They did however suggest the brilliant solution of using one of their parallel ADC chips with two DS2408 8 channel switches. Basically, I could use a channel on each of the switches to monitor the ADC. The switches would use the 1-wire protocol so I can use that communicate over longer distances. I am currently waiting for those parts to come in.

In the mean time, I am learning more about operational amplifiers that I ever thought I’d need to. I plan to use an op-amp IC to boost the weak signal from the photodiode to somewhere closer to the 2.5 or 5 volt maximum of the ADC.


Posted in Electronic Tinkering | 2 Comments

Temperature Monitoring v2.0


I finally succeeded in getting the temperature monitoring system set up the way I want it. It would be embarrassing to admit to how many times I’ve re-written the code. I wanted a modular code base that would allow me to add “tasks” on a schedule. My first few versions did this part, but would save some data locally, which it would then log on a schedule. In the end, this wasn’t feasible. There just isn’t enough memory on the chip. I was getting random freezes or garbled output – so despite spending hours trying to isolate the memory leak, it still wasn’t reliable.

The other problem with logging data after the reading was taken is that the data had to be timestamped – which means the Arduino had to stay in touch with an NTS server in order to sync it’s clock. I found the code supplied by Arduino for doing this isn’t production quality. It was causing a number of freeze-ups and it had to be modified to work with the new Ethernet Libraries in Arduino v1.0.

Long story short, I have a flexible modular code base that uses the pachube library from

I mounted one temperature sensor in a duct near the furnace so I can see the furnace heat cycle. I hope to eventually use a function to convert the graph to binary so I can calculate the furnace “on” time and therefor fuel per hour.

One sensor is mounted outside (in a box protected from the wind) and the last sensor is in the basement ceiling. I recently received a few more so I’ll solder them up when I get a chance.

The output can be seen HERE!




Posted in Electronic Tinkering | Leave a comment

Geiger Counter Shield + Tubes Arrived!

I’m pretty excited about the next sensor for my home monitoring system. I ordered the Libelium Gieger shield from Spain. It arrived about 6 days later. The shield comes without a Gieger tube, although you can order a ridiculously expensive one from the same company.

Gieger shield

Ebay has the best options for ordering tubes. I ordered two different Russian made tubes the SBM-20 and the SBT-9. They each cost about $10 and arrived within a week. They are advertised as Russian military surplus. The first package arrived labelled “Used Audio Tubes”!


Geiger Tube



Maybe next week I’ll have time to play with these. I plan to install it in my basement for a month or two to monitor Uranium to Radon decay, then I’ll move it outside to measure the local background radiation.

Posted in Electronic Tinkering | Leave a comment

Multi-probe Temperature Monitoring

I have just received my second Arduino so I can continue developing the temperature monitoring system.

My first attempt at using 2 Dallas DS18B20 sensors failed. It took way longer than it should have with the bread board to get them reading correctly.

The first step to using two sensors is to identify the ROM code with each chip. To do this, I connect one – then load the sketch from HackTronics that gets the ROM address. I then plug that address into a logging sketch and call each chip individually.

I have soldiered the sensors to 50′ lines with telephone jacks on the end. Then I built a small arduino shield that is wired to telephone plug with a 3 port splitter on it. It was a  ton of fun testing  – one in the freezer, one on the heat vents and one ambient temperature.  The sensors seem to be slow to react to temperature changes (a couple minutes) but extremely accurate once the temperature has stabilized.

That completed the easy part. The hard part was writing the code. I need this to be expandable as I add future sensors so I wrote a simple Task Scheduler that allows me create tasks, then assign them a time to run. Once they’ve run, they re-assign themselves their next run. So far so good.

I also don’t want to connect to the server every time a sensor is checked. I’d like to be able to grab a few data points, then, try to log them. If the log fails, continue trying but also continue grabbing new data points (as memory allows).

I was concerned that connecting to the server might take a few seconds or even minutes at times, and might therefor cut into processor time that could be used logging events. Since I had no idea how busy the processor would actually be doing all this, I built each task to log the time it takes, then every time period (I use every minute) I calculate the processor usage. I add this to my data logging object which will log this to the server with my other data.

For a guy that doesn’t know C programming this was quite a challenge. I completely realize how I was taking “Strings” for granted in other programming languages. Simply adding together two sets of characters in C can be quite a task. My first attempt failed due to poor documentation on the Pachube website. I planned to have Pachube take a list of datapoints in the format


I finally got this mostly working, but while using the debugging data from Pachube I realized that feature is not yet supported. My only direct option is to log using a simple <timestamp>,<value> set. This completely changes the way I have to store my data on the Arduino, so that put me back to the drawing board. The next obstacle was getting the timestamp on the arduino correct. Since the Arduino can only keep time by counting seconds, it has to know what time it was initialized. Since my device will always be connected, I plan to have it update it’s clock using Time Services. The problem here was that the Time examples that Arduino provided all used the old Arduino Ethernet libraries. So after many hours of debugging and updating that, I finally got that working.

Earlier this week, I though I had everything working. Then the device would freeze at seemingly random intervals. I thought the problem was memory related so I spent hours building functions to track memory usage to see if I had a leak.

Tonight, I finally figure out the problem isn’t mine – it’s the Time library functions. Every couple minutes the clock tries to resync itself, and for some reason it’s freezing during that process. More on that once I get that worked out!

Posted in Electronic Tinkering | Leave a comment

Temperature Monitoring

My first step in building my home energy monitoring system is logging temperatures. My first attempt used a simple thermistor. I tried to use a long cable so I could locate the Arduino in the basement and the sensor closer to the middle of the basement. This didn’t work since the resistance in the wire skewed the sensor readings way too much. I’m currently logging the data using the thermistor mounting on a wire problem about 6 inches from the Arduino.

Arduino in the basement

I use an Arduino Uno with the ethernet shield. I log data to Pachube. You can view the output here.

The first chart is the temperature, the second is static randomness. I wrote the sketch to check and log multiple sensors but I haven’t connected a second probe yet.

I also track failed attempts at logging data. When the number resets to zero I know the power was disconnected to the unit. I plan to track number of updates, but as you can see, that counter doesn’t increment yet. Another thing to add to the list.

The output is in tenths of a degree. The data is logged every 10 minutes. The temperature in the basement varies from about 16 degrees to 10.9 degrees depending on the temperature at the wall. I am going to move the Arduino and sensor away from the stone wall, but first I have to wire a new electrical outlet in the middle of the room.

I’m current waiting for my second Arduino to come in with a couple of Dallas temperature sensors so I can start working on a better version using the 1-wire protocol. This will allow me to take the temperature in each unit as well as the basement. More on this to come.

Maxim (Dallas) sent me a great package of free samples that I’m planning to use. The set back is that they are much smaller than I anticipated. They look a lot bigger in the information brochure. They also send me Surface Mount versions. In order to use these, I will have to build a Printed Circuit Board.  I plan to use Sparkfun to manufacture the board, but of course first I need to design a PCB.

Before I can do that, I need to draw the schematic, so that has brought me Eagle. So my next steps are:

  1. Learn to use the Eagle Schematic Editor
  2. Learn to use the Eagle PCB board program to make a gerber file.
  3. Order the board.
  4. Give up caffeinated coffee completely.
  5. Learn how to soldier using a magnifying glass.



Posted in Electronic Tinkering | 1 Comment