Thursday, August 7, 2014

my notes on Adafruit's "Firewalker Shoes" tutorial...

This post is intended to provide clarity to the same problems I ran into while attempting to building the "firewalker" shoes found on the Adafruit tutorial page. I am in no way affiliated with Adafruit and this page is intended for educational purposes only so I am not responsible for anything you do.  On that note, my hat is off to the original designer(s) of this project.  it's pretty darn cool...

first, the FW tutorial does tell you to first read the getting started with flora guide.  Make sure you do this.  this will ensure your computer has the drivers as needed.  But the Adafruit tutorial covers the transfer of files and definitions in a way that (to me) seemed more complicated than needed, so the way I present below is just an alternative method.  both work just fine.

Once you have verified your drivers are ok, you should also have your Arduino IDE platform installed already.  So, let's proceed.

In the getting started guide, it tells you to download the appropriate IDE zip file.  Both are quite similar, but I am focusing on Windows platform here.  fyi, if you are attempting to use Linux arduino IDE, you are on your own.  As far as I can tell, it's not possible to use linux for this code and a windows/mac VM won't work either.   There are certain functions included in the FW code that simply are not supported in the linux version and I couldn't get the linux beta version to comply either.  The IDE will see the flora and you can write other code just fine, but the FW code has issues.  I recommend sticking with Windows or crApple just to save time and you cannot use a windows VM because the USB device disconnects when you upload your code.  unless you have a way to automatically re-attach the usb device to the VM, the VM won't see the flora and can't finalize the upload.

Unzip the file to a temporary location.  Open folder /hardware/arduino and locate boards.txt.  Copy this file and place it in your matching Arduino folder, overwriting the file.  In winXP the location is C:\Program Files\Arduino\hardware\arduino.   If you dont wish to overwrite the existing file, just open the new file and search for "flora".  Copy everything starting at flora to then end of the file, then paste it into your existing boards.txt file.  This will import the new board definitions you need for flora, as well as gemma and trinket.

Now that you have the necessary definitions, you will also need the variant files the definitions are referencing. Copy folder /hardware/arduino/variants/ and paste it into C:\Program Files\Arduino\hardware\arduino.  If you don't wish to copy the whole folder and overwrite the existing folders, then just make sure the "flora" folder and any other missing folders are copied to your existing C:\Program Files\Arduino\hardware\arduino\variants folder.

now restart your arduino IDE.  from here, you should be able to run all of the provided code on the adafruit tutorial.  but the code is not the only problem you might face...

when you get your test circuit up and running, make sure you run both the test code and the final code.  notice the differences when you tap the velostat paper.  the test code will actually respond to the step sensor.   the final code actually varies on the pressure detected by the step sensor.   light steps produce a small reaction while heavy steps produce a much larger neopixel reaction.

Aside from that, there are do's and don't with the velostat paper:

less tape is more
  • in order to get the velostat to send the needed signals, the pressure must occur on a piece of velostat where both the upper thread and the under thread are crossing.  imagine the upper thread going from northwest to southeast, while the under thread is going northeast to southwest.   the center where those two threads cross is the "cross point" where the velostat will react.   if you place pressure on any other point on the velostat, the neopixels will not react based on the provided FW code.  You can adjust the FW code, but I am not going into that.

  • DO NOT use a lot of tape on the velostat.   any part of the velostat that has tape on it will not react as it should and thus won't send the needed signals to the flora or other arduino board.  I recommend using just one piece to anchor the end of the thread to the center of the velostat. Loop it around a few times, then add a piece at the edge of the velostat to prevent it from moving around much.  But do your best to make as many cross points as possible.  The more points you have to work with the FW code will respond better.   Whatever you do, do NOT just cover the whole surface in tape or another adhesive.
  • DO keep the threads opposite from each other.  the picture above shows the upper thread going northeast while the under thread goes southeast.  this will work for testing but for production it can present problems.  if the two threads touch/cross, they will send false signals to the flora and the neopixels will flash unexpectedly or they may not flash when they should.  So when you place the velostat in the shoes, you will want to ensure the threads can't possibly
    too much tape
  • Once you have figured out a decent cross threading method, you will want too test the velostat on actual shoes.  Here you will find the sole of the shoe is critical.   If you plan to hide the velostat under the sole, I recommend finding some kind of insole that has a very hard/solid base.  if the base of the insole has any kind of cushion (and most do), it will not provide the needed pressure to allow the velostat to react.  maybe some factory shoe insoles are different, but I don't have the means to test them all.   the tutorial shows the use of all-stars which have some very, very thin insoles.  I use skate shoes which are made for absorbing shock, so not the best choice without replacing the insoles.

    To correct for this, I cut up a plastic container to make an upper and lower piece of plastic to use as pressure points to sandwich the velostat together.  the lower piece goes under the velostat and the upper piece goes on top, but under the ball of your foot.  Again, if you find an insole with a
    hard enough base, you can place the velostat under the insole iteself.  One way or another you have to ensure the velostat will react to your foot steps, so be sure to thoroughly test the step sensor before attempting to sew together your final production.  
hard plastic to sandwich the velostat with thread exiting on opposite sides. 

Once you've got you're shoe assembled, remember to adjust the LED definitions as needed depending on how many LEDs the length of your shoe requires. 
  1. #define N_LEDS 39 // TOTAL number of LEDs in strip
  2. #define SHOE_LEN_LEDS 20 // Number of LEDs down ONE SIDE of shoe
  3. #define SHOE_LED_BACK 5 // Index of REAR-MOST LED on shoe

Gluing the LEDs is harder than it looks.  If you are using shoes you like or maybe new shoes, then you will likely mess up the first time leaving lots of excess glue on the base which doesn't look that great.   I recommend dry placement of the LEDs around the shoe and then add the rubber bands.  once the LEDs are secured by the rubber bands, move the bands a few inches out and then pull up the LED strip so you can squeeze in the glue.  then just move the rubber bands back into place.  once all but the bent sections of the shoe are glued, go back and move the LED strip into its ideal height from the base as it will have moved slightly when you started gluing the opposite side. 

I dont prefer the suggested use of conductive thread for this project, mainly because of the type of shoes I used.  I'm not a fan of sewing and if thread is used then it needs to be sewn a lot throughout the inside of the shoe to keep the thread tight.   Plus securing thread to the flora isnt fun either.  I just prefer to use twisted pair wires such as cat5 cable.  the cable can be tucked under the sole and stays out of the way good enough to work with.   plus the wire is easy to solder onto the flora. But thread can work for other projects much better that it did for me and my shoes.  Use your best judgement.  I thought using threaded cable worked really well for creating the cross points for the sole sensors because the wire was moldable and stayed where I placed it.  Whereas thread kinda just went where gravity pulled it.

flora on the tongue
it's mostly just my own preference, but it also matters where you plan to stage the flora.  I dont like high tops so placement of the flora can't be exactly like the tutorial for me.  So I chose to place it at the top of the tongue and run the wires up from the base of the tongue. I sewed on the flora using the empty flora pin holes and soldered all the rest of the pin holes as needed.

Here is a working prototype using default code from the tutorial.

Here is the finished assembly:

Cannot find a Leonardo....this usually means the USB is not recognized by the computer anymore.  Unplug the USB from the computer and plug it back in.  then check the TOOLS menu on the arduino IDE and see if the SERIAL item is available.  if it's not disabled, make sure the available COM port (or whatever the mac equivalent would be) is selected.  if it's still disabled, try unplugging/plugging again.  or reboot.  the arduino needs a usb device.

A9 is not defined....this happens mosts when you either haven't selected the Flora as the board you are using, or you haven't (correctly) installed the drivers for the Flora on your machine.   If it can't find a flora or doesnt know what it is, then it won't know what pin A9 is.

LEDs not reacting to step...obviously check your connections for the upper and lower threads located between both sides of the velostat.  make sure the two wires/threads are not crossing at all.  if everything looks ok, time to add some debug code to the program.  Below is what I did to see what the sensor was outputting.

Upload this new code and then use the serial monitor to watch the output.  Put some pressure on the step sensor and the serial monitor and see if the values change as you add pressure.  if the values change then your arduino is getting data from the sensor.  if the "stepFiltered" value does not fall below 200 no matter how much pressure you add, then there is some problem with the velostat sensor.  maybe the placement of the threads is bad or the velostat is defective.  time to experiment. if the values fall low enough, then either the flora is not sending the signal to the neopixel strip, or the neopixel strip is not getting power.  you can test the strip by touching and releasing the 2 sensor wires/threads.  once they make contact and then separate, the strip should light up similar to a normal functional step.  if the flora is sending a signal to the strip, then you can use a voltmeter and place the negative end on a flora ground and the positive end on the A6.  add pressure to the step sensor then release and watch the voltmeter for any kind of change.  if no change, the flora is not sending any signal to the strip.

Wednesday, August 6, 2014

Myths about Solar Energy Systems at Home

So the coming elections are causing a lot of misinformation to fly around like most any election.  So here is my contribution towards a fair representation of the truth.

My friend had a solar installation on his rooftop and after asking him a ton of questions, I eventually found myself signing up as well.  since then I've seen what it can do and why the energy companies hate it so much.


This is the biggest myth that annoys me the most, so I'm addressing it first.

Anyone connected to the power grid pays a monthly service fee.  The service fee acts like insurance for everyone when something goes wrong and your power company has to fix it, this service fee basically pays for it.  Some people think they can do their own off-grid solar installation to avoid this service fee and "stick it to the man."  But if they did that, any problems with power equipment stored on their property would be charged directly to that home instead of being covered by the service fee.

The service fee varies between area and utility company.  I use SRP and my area is charged $17/month. My friend in Surprise, AZ has APS and they charge him $33/month.    The picture here shows I am getting charged the appropriate fees, JUST LIKE EVERYONE ELSE.

If I produce more energy than I use that month, the only charge I receive is the service charge and taxes, exactly as pictured here.  There are no other fees on these bills from which solar customers are exempt.  saying we don't pay our fair share is a complete lie...and I will go over why that is.


I dont hear this often but when I do I am quick to call bull shit and make fun of the person spreading the lie because they are likely just jealous of my summer electric bill.

The other higlighted area in my image above is the energy charge.  This is my USAGE.  This is what really separates solar from non-solar customers.  I used $46 worth of electricity in Phoenix, AZ in JULY.   Anyone living here knows that's impossible even with the most energy efficient air conditioner and you really like it hot in your home.   My bill for this month last year was $250...and that's low compared to most people around here.

The truth is, energy produced on your own is way, way, way cheaper than buying it from the power companies.   I don't know the exact rates but I can use my current and former usage as examples.  Last July I used about the same amount of electricity.   Close to 1800KWh which came to $250 total.  So why is my bill only $46 in usage (plus taxes and fees)?

Solar customers are producing energy and feeding it to the grid.  The grid that everyone uses to get power.  Every KWh that is fed into the grid is credited to that solar customer at a 1-1 ratio.  So if I give the grid 200KWh's that day, I can use 200KWh's without getting charged.  If I use more that that, I get charged.  If I use less that that, those credits roll over to the next day, or month.

But just because I am producing the energy does NOT mean I am not paying for it.  My solar lease is close to $90/month and will also inflate as time goes on.
So technically my combined July energy bill is $150.  
That's not as bad as last year's bill but it certainly isn't free.  What I tell my friends about the benefits of solar is that is basically stabilizes your electric bill to a manageable amount during the high usage periods, such as summer in AZ.


This can only be said for solar customers that are completely off-grid where they store their energy in on-site batteries.  The batteries are what people are claiming as polluters because maybe they aren't recyclable or properly disposed.

But off-grid installations are very rare these days and typically done by the home owners themselves.  The newer leased installations, such as the one I have in my home, are on-grid systems.   All the energy we produce goes right into the grid and that energy is used by other homes.  This energy was produced from the sun, inverted to AC current, and fed into the grid.  So technically, solar customers are providing much cleaner energy to the public compared to the power companies themselves.

Most power companies are using nuclear or coal based power.  If you think solar is polluting over that, I suggest you do some more research.


So why do the power companies want you to believe lies about solar?  Quite simple....they are losing money.   Before solar, these utilities (which are really legal monopolies) were just sitting back and collecting a paycheck.  There is no competition with other utilities because you can only get service from the utitily company in your area.  It's slightly understandable since it's their infrastructure and letting another company attempt to provide alternate service and fair competition would be a public nightmare as all of the roads would be torn up to do so.

But your utility company is the only option you what exactly is twisting their arm to keep them from overcharging and under-servicing?  Nothing.  Those are the reasons monopolies are supposed to be illegal, because they abuse their power.   And when the new America started finding ways to live without the old government, did the monarchy just accept the loss of all those taxes?  No they did everything they could to keep the money pouring in just as much as it did before.  So that's what APS and every other utility provider will do as well.  They will do anything they can t protect their profits.  Their profits do NOT benefit the city...they only benefit the shareholders and executives.  They simply don't care about you.

All $250 of my last year's bill went to SRP, just like every other non-solar home on SRP or APS turf in my city.   But this year, SRP gets $60.  February 2013 SRP got $120 from my pocket.  February 2014 with solar, SRP got only the $17 service fee and taxes I am required to pay.   Multiply those profit losses by the rapidly growing number of solar homes popping up all over Phoenix and the total will get very big very fast...and that's just for one year.  My solar lease is for 20 years.

That's 20 years of profit loss from one household and SRP can't do anything about it...neither can APS.  But APS can still spend millions of dollars funding political candidates that will help them pass legislation to tax the hell out of solar installations.  While they aren't admitting it, they sure aren't denying it.   The first tax last year was proposed as a $100/month fee to be paid straight to APS...not the city.  That was denied and APS was told to go f*ck a political manner.   But APS is going around that now to elect their people to pass the same kind of legislation.   Ever wonder the kind of special interests that buy off political leaders?    Guess what APS is doing....


I prefer solar over non-solar.  But these solar companies and power companies are still businesses.  They still want to turn a profit even it if means looking the other way a few times during their sales pitch.

The solar companies will tell you your solar energy credits will roll over from winter and be available for you in the summer time, which is when us AZ folk need them the most.   Then at the end of the year, your power company buys back all your remaining credits from you at a wholesale rate.  Basically a rip of to the solar customer, but in the long run it doesn't matter much.

But that's not entirely true depending on your power company.  Mine is SRP.  Turns out SRP chooses to settle these unused credits at the end of their FISCAL year.  And wouldn't ya know it, that just happens to be April 30th....right before Phoenix summer hits.  So all 2000 of my spare KWh's that I really needed for my summer pool season are gone.

2000KWhs bought from SRP would cost me well over $250 if not $300.   But because they buy them at wholesale rates, I got $70.  So right there, SRP will net at least $200 from my energy production.  After that, because I am using more energy than I am producing and I no longer have credits to pull from storage...once again SRP profits.

I confronted my Solar provider about this and they claim they have never heard this before.  My solar salesperson wouldn't even return my messages.   If you are thinking down the solar road, check with your power company to find out when your credits are wiped clean.

Even with all that, I am still paying less for my electric.  My lowest usage month in the history of this house since I moved in was $90. Now my solar bill is $90 and I am producing more energy than I need.   So my energy bill is regulated and I am still credited for the excess energy I produce.  Overall, it's a good deal.   But I  no longer recommend it to anyone because the utilities are winning the war.  They are bribing all the right people and getting more and more laws passed to kill everything good about solar.    Eventually, they will have enough laws passed to where solar will cost more than non-solar.  If you want to invest in solar, then I recommend you look for a plan that is NOT a lease, but more like a mortgage where you OWN the hardware.  At least then you will be exempt from some of the laws that are targeting leased systems.