Sunday, July 26, 2015

Mina Deployment - Columbus Ruby Brigade Presentation

In case you are searching...

Here is the presentation Vasanth and I gave at CRB: presentation.

This most interesting items can be found in github here: https://github.com/toddh/minademo.

Especially look at config/deploy.rb. The wiki contains my recipe for super simple server setup.


Sunday, February 15, 2015

Creativity Inc. -- A great book

Read this book. Ed Catmull does a great job describing the creation of a culture that supports creative endeavors at Pixar Animation Studios. Their approach centers on removing impediments to trying new things. These include acknowledging that we don’t know everything (and making it OK to admit that so we can learn new things), loosening controls but setting limits, trusting people, accepting risk, and removing items that create fear (of being wrong) in the environment.

One quote: "If you aren’t experiencing failure, then you are making a far worse mistake: You are being driven by the desire to avoid it.”* I’ve read about these ideas in  other books, notably the great “Adapt” by Tim Harford, but I really enjoyed this book as it tied things together in a great narrative that I could identify with. While the book is not a how-to, there's enough practical information and anecdotes that you can really put some of these ideas into practice. I really enjoyed it.

* Catmull, Ed; Wallace, Amy (2014-04-08). Creativity, Inc.: Overcoming the Unseen Forces That Stand in the Way of True Inspiration (Kindle Locations 1730-1731). Random House Publishing Group. Kindle Edition.

Monday, January 6, 2014

Some coil calculations related to the ID-3LA

So continuing on from last post, I did some calculations to see if I could eek out more distance from the ID-3LA.

Dusting off my old EE knowledge, and reading on the web (I went to OSU and we all used the Kraus book -- but mine is locked up somewhere in a basement with the Art of Electronics), I came up with the following.

My main references were:


The question I was trying to answer was: "If I just build a bigger coil, how much distance can I get?"

First, I used http://sagemath.org to solve for the magnetic (B) field as a function of coil radius (a), distance(r), turns (n), and current (I).  This gave me:





The values I observed for the actual coil as a maximum read distance were:

Name Value                    Units
I    0.0369927705564946       Amps
n    71                       turns
a    0.06                     m
u    (4.00000000000000e-7)*pi Henry/meter


So, I have a B-field of 3.74583992365717e-6. I'm going to take that as the required B-field.
Graphing the above equation for different values of coil radius, gives this graph:




If you believe this, it basically says that increasing the radius of the coil will increase the B field a tiny bit. But not enough for my needs. Note that as you increase the radius, you need to wind more turns to maintain the required inductance for the ID-3LA. This is good from the standpoint of generating a B-field, but bad from a cost standpoint.

So, my belief is that to significantly increase the distance, I'm going to need more current or more inductance. Here's a graph with some options:



So can I design a circuit with 10 * the current (or close) and a radius of 0.25? Or maybe more current and more inductance? I'll have to look into it.

If anyone comes across this and sees an error (which wouldn't surprise me), please let me know.

(For more detail, I've attached a pdf of the sage calculations here.)


Monday, December 30, 2013

Building a coil for the ID-3LA

Partially to put my thoughts in order and also for others who might be trying this…

Here’s a list of steps that I performed to build a coil for the ID-3LA which a bought from Sparkfun (here). I found a data sheet online here.  This really is pretty easy to do and since my EE skills are really old and rusty, fun.

Decide on what wire to use. I built two: one using 30AWG magnet wire from my local Radio Shack and also 26AWG magnet wire that I got from my local Electonic Supply. Why 26AWG? According to the Microchip AN678 application (here), anything above “larger” than 26AWG (e.g. smaller numbers but bigger wire), has a lot loss do to skin effect. See the section titled “Wire type and ohmic losses.” I was hoping to get more distance out of the 26AWG coil.

Calculate coil radius and number of turns.  I’ve seen a variety of calculations and suggestions for starting points (including in the ID-3LA data sheet). I built my first coil 30AWG coil using the information in the ID-3LA data sheet in section 12. 6cm radius and 71 turns. I built my second coil with 26AWG and used the calculator at www.circuits.dk for the same size and the inductance from the ID-3LA data sheet. Based on measuring my first coil, width was about 2mm and height was about 2.5mm.

Output from circuits.dk

Build the coil. I measured 6cm for a center point and used finishing nails to make a "form" (see picture). Originally I used some trim coil to "smooth out" the circle, but the wire kept slipping under the trim coil. I decided it didn’t help that much so I gave up. I’m sure there’s a way to make a more tightly packed coil, but I don’t know how much you gain. I basically wound and counted the required number of turns. When I reached the required number of turns, I stopped and taped the coil with electrical tape. I then wound two turns more to allow removal of loops in the tuning process. I taped the whole coil, with the turns that could be easily removed, in a different color electrical tape.
Rig to wind coil
Insert into circuit. To remove the insulation off the magnet wire, I used a lighter and then cleaned with a bit of steel wool. Seemed to work acceptably though I’ve seen other suggestions. My magnet wire did not appear to have “solderable” insulation. For the 30AWG wire, I attached some 22AWG solid conductor wire. To do this, I tinned the 22AWG wire and tried to tin the 30AWG magnet wire (which didn’t work to well). Then I wrapped the 30AWG magnet wire around the tinned 22AWG wire and heated. Seemed to work but there’s got to be a better way. For the 26AWG wire, I inserted the magnet wire directly into the breadboard.
Completed circuit
Tune and test.   I hooked my scope (a DSO Nano) up across the leads of the coil and started measuring. You can start to see the limitations of a $90 oscilloscope. ;) One thing I noted was a sine wave at ~360 Hz (picture). I didn’t investigate this. When I set the time division to 1 microsecond, the 125khz signal shows up clearly.

360Hz Harmonic

12khz Signal

Note:  I tried measuring with Vrms with my Fluke 115.  It gave me a Vrms of 1.5V and a frequency of 32kHz.  Maybe it's my wall-wart power supply?

With the 30AWG wire, my Vpp was 30.8V. I was able to read a tag (used a token hooked to an Arduino) but the range was very low. I remove a coil at a time and was able to increase the range up to Vpp of 109V — and at that voltage, couldn’t read the coil. I didn’t investigate this but theories would be Q was too high so that the influence of the token really had a negative effect or maybe this was more voltage than the ID-3LA could handle. I added one coil back and got a Vpp of 76V. With this, I got a read distance of about 2 inches.
30mm 125khz token from Trossen Robostics
With the 26AWG wire, I was able to get a Vpp of 77.4V and a read range of 6.5".  Is this about the max that can be gotten out of the ID-3LA?

Note:  Some have suggested tuning by measuring the current consumption of the ID-3LA.  I didn't try that.

For curiosities sake, I decided to order and directly measure the inductance of the 26AWG coil with a Sinometer UT58D.  It gave me an inductance of 1.332mH, an Rdc of 3.9 ohms, and a capacitance of -37.4 micro F.  I was pleasantly surprised that the inductance closely matched about what I wanted.

The bottom line though was about 6.5" of read distance.  I'm hoping to get about 16".  So, my next project is to do a little research on how to increase the read distance.  Supposedly increasing the radius of the coil can increase the distance.  But before I go to the extra effort of winding another coil, I'm going to do some calculations to see if this would actually provide benefits.  I suspect, and others have noted, sooner or later its about power.  If that's the case, I'll need to build my own circuit.

Open questions:
Why does the Fluke read values so differently?
Should I have fine-tuned with a capacitor?
Why did the ID-3LA fail to read when I tuned Vpp up over 100V?
What really is the best way to strip the insulation off of the magnet wire?

Next step:  Try to remember enough emag to perform some calculations and investigate the feasibility of increasing the coil size.


Sunday, June 9, 2013

AngularJS, Rails, and resources (aka models)

I'm building a web application with Angular JS and Rails.  Here's one little challenge I ran into and my solution, both for my memory and anyone else that might run into the same (simple) problem.

Problem:  When loading Angular Resources from a Rails server, the Angular JS model ends up attributes you may want to just leave on the server.  E.g. created_at and updated_at.  If they are in the Angular JS model, when your code updates the model, Rails throws some sort of attribute permission error (either a mass assignment error, Forbidden Attributes error, ...).

I wasn't using anything to serialize and render the JSON.  (That turns out to be the catch).

Solution:  I ended up using active_model_serializers to build the JSON and omitted those items.  Most examples out there just assume you're already doing this.

Discussion:

Both InheritedResources, restful_json, and angularjs-rails-resource out of the box don't do any filtering on the attributes.  They kind of assume you're already using something to build the JSON that you want returned.  If you aren't (I wasn't), you get create_at and updated_at in the Angular model.  I don't want my client to know about those items so I need to tell the server not to send those to the client.

I ended up with settling on restful_json and to keep it from sending everything, I ended up using active_model_serializers.  I created a serializer for each model such as this:

class BlogEntrySerializer < ActiveModel::Serializer
  attributes :id, :entry_name, :entry_text, :my_flag
end

Note that I did not include created_at and updated_at.  Hence my client doesn't know about these at all. Or another way to put it, the Angular models doesn't know about these attributes.  Thus, when I do an udpate, they don't get sent back to the server and restful_json will fill them in with appropriate values.



Tuesday, May 7, 2013

1Q84 1Q84 by Haruki Murakami
My rating: 2 of 5 stars

After listening to 38 audio disks -- I wish I had those hours back.

A couple of things attracted me to this book. I enjoy parallel worlds and a bit of light fantasy and have read very little set in Japan. So I embarked on reading this highly reviewed book by a Japanese author. Maybe I was expecting something similar to Umberto Eco but from a different direction.

IMHO: Not really enough happened, nor was the text evocative enough, to justify 40+ hours of listening (or a 1000 pages or so if you're reading). There was just enough interest to keep me going and I was hoping for some great payoff in the end. Didn't happen.

I don't usually write reviews, but thought I'd leave this little signpost for future readers. Give it a try, but if you find yourself starting to wonder if it'll change significantly (for the better or worse) after a 100 pages, it doesn't.

View all my reviews

Wednesday, January 23, 2013

Locating Gem files in deployment isnt always complicated

While struggling to get my application running in deployment with both rvm and bundler, I started getting errors that sass-rails couldn't be loaded.

But sass-rails was in the assets group of the Gemfile, so was bundler including the gems in the assets group?

No.

Turned out that ActiveAdmin was requiring it.  But, because I had it in assets, it wasn't being loaded into my production set of gems.  Solution - move it out of assets.  This was listed in the active_admin documentation, here, but I skimmed right past it -- assuming that the Gemfile would save me.

One more problem:  I couldn't install bcrypt-ruby and couldn't do sudo.  So I tried this in the Gemfile:
gem 'bcrypt-ruby', :require => 'bcrypt'
I picked this idea up from here:  http://stackoverflow.com/a/3901165

Voila!