Monday, June 2, 2014

Nrf24l01+ antenna



I set up shop in the living room so I could fiddle with he nrf24 radios and Arduinos between commercials on the TV.  I bought a few arduino 3,3v  pro minis and some radios with the zigzag antennas.  I loaded the example to test the radios out and all I got was failed and time out packets.  The receiver was getting the packets periodically but timed out in the ack part of the transmission.

The next thing I did was lower the transmission speed to 250k, but still no joy.  Thinking that there was a loose connection I pressed down on the radio and noted that it started completing transmissions.  It seemed if I touched the antenna on the board the transmissions completed - as soon as I removed them - they failed.

So power or antenna was the problem - rechecked the power and saw an alligator lead wire laying on the table and just clipped one on the radios antenna on the PCB and voila (it's yellow in the picture) - perfect transmission.  The was probably all kinds of mismatch between the antenna and lots of vswr - but it worked. 

I am just wondering what would be a better way of putting a wire on the board to make a matched antenna.

update - it seems that a full wave antenna for 2.4ghz  is amazingly close to the length of the alligator clip length (~4.92 inches) - who have thunk it? 

Wednesday, April 23, 2014

WHEEEEE - Raspberry Pi Is totally fun

I started out in personal computing with a soldering iron in my hand - then along came the radio shack model 1 - it was enthralled... All that computing power on my desk.

Now i run into a Raspberry pi and it is a little dynamo - I have it right now installing mysql .  I have installed apache, and have had it updating Xively with the %busy variables for a day or two now.  Even have a Arduino mini sending some data over.  Whew - lots of Goggling and lots of cut and paste.

It is exciting to see the Pi really busy - it is more fun trying to keep the little green bar in the bottom right corner pegged at 100%.

Been playing with the Arduino for a year or two now - fun, but a lot of wires and a lot of scratching my head figuring out how to stuff all that code into it...

Goal is to
1) Document all this
2) Get something connected to the Arduino (temp and/or humidity and/or Barometer)  Sending it all up to Xively and saving it locally.
3) Build some kind of page to display it on a local browser  & smartphone

In the very near future hook up some nrf24l01s to some Arduinos and put out in the Yard , basement all over the house...  You get the idea.

Currently doing the things mentioned here. and here

Since it is much more fun doing all this, than documenting it - stay tuned - film at 11:00

Sunday, April 20, 2014

Raspberry Pi and Arduino

In spite of a severe cold - or probably because of it I decided that I would play with my pi.

The goal is to get the weather information from my Weather Station inside and send it out to the internet of things someplace.  I have had it running in the past - but it invloved me leaving the desktop running and eating way too much power.

I have seen a lot of elaborate lashups using spi and whatnot hooked into the pi and the nrf24l01 - but I figured that I would do it different.  Let the Pi do what id does best and the Arduino do what it does best.
The pie is a Unix computer and will do the heavy lifting since it has internet connectivity built in and lots of ways to display the data or send it out to one of the IOT cloud servers.

The Arduino because of its robust pin protection and scads of code to talk to the nrf24l01.
Goals
1) Run the Pi from a hard drive.  I have seen lots of posts of sd card failures after a while.  They have a limited R/W Life.  Plus I have a bunch of old hard drives.

2) Plug the Arduino into the Pi and run the Arduino IDE there.  This keeps me from having to run all over the house and finding various things to get a sd card reader set up and into one of my computers.  It is so much better to keep it all in once place.

The key to all this is a Powered USB hub - it has everything plugged into it and powers the whole show.  I found one at newegg that has 7 ports and an on off switch. Keyboard and mouse go in the end - everything else goes in the top - to reboot a locked pi without dealing without unplugging a USB - there is that switch - very convenient.  The PC has a hundred watt power supply and uses a lot of power spinning up 3.5 terabytes of hard drive storage.  The power plug for the hub is 10 watts, very efficient.

I won't bore you with the details - others have already done an excellent job of documenting what to do.


  • Setting up the PI - I used Berryboot since it has an option to install directly on a hard drive. My settings include booting to a desktop and enabling SSH,
  • How to install tightvnc on the PI - http://elinux.org/RPi_VNC_Server
  • Installing the Arduino IDE was as easy as sudo apt-get install arduino
  • Putty  and vncviewer installed on the PC and lets me get the monitor the PI is plugged into back onto the PC.

Sounds easy - and it was - but it took a while - The Pi is not know known for its speed.

Part two will involve actually plugging the hardware together and running some simple scripts (and for me to start up the Python learning curve)

Tuesday, April 2, 2013

And this weeks winner for cloud storage is...

I work behind a corporate firewall.  It is amazingly good at filtering out cloud storage solutions functionality. Like I mean they do not work at all.

I was using my fave DropBox for a long time - but a recent "upgrade" to the firewall broke that.

Google drive has always worked. Unfortunately it doesn't give me the organization (folders) I need to keep things straight.

When Cubby came out I liked it instantly, since it allowed you to set any folder in the filesystem as a cubby.  So I could make the project folder for Visual Studio a cubby as well as the Eclipse workspace.  Both rather inconveniently buried in the obscure paths in the filesystem.

I originally used the cloud storage solutions to store my arduino code.  I stored the Arduino program and all the code/libraries on DropBox. So whatever computer I was using had a recent copy.  It just took a tweak to change the default place Arduino wanted to store the .PDE and .INO files.

The problem was cubby didn't pierce the firewall at first. That is until I found out yesterday that it allowed creating network shares using WEBDAV.

There are other things I like about Cubby. like computer to computer direct transfer. Plus you can set it up so it doesn't always sync a particular folder(cubby) so you can get the files only if you want to, but not saddled with them appearing on all computers.

I just wish Cubby allowed multiple file up/downloads through its web interface.

I haven't figured out if I am going to have to find a sync program to copy the local folders into this new share - or set up Cubby somehow to run from/point to the webdav share - which by the way shows up as a new drive.  Stay tuned - film at 11:00

If you want to try cubby - use this link - I get a gig more storage if you do . Thank you

Friday, March 29, 2013

COSM .NET SQLSERVER and memory

I have an Arduino outside sending in time,temp,humidity, and tips of the rain gauge   The inside receiver has a barometer so it reports pressure and inside temp. That being said - it was a pain to keep track of all this.

I cobbled together a C# app to read the serial port and update COSM with the stats.  I like the little lines going up and down with the weather. I especially likeed the big dip as Sandy went by.

The C# desktop app was getting way to cumbersome as any DIY project - lots of text boxes and  a cluttered interface.  I was reading a question in Stackoverflow and had an ephiny  moment when the answer was to split the application into two pieces, the Logger, and a display - web or windows.  The middle piece that allowed this was a local SQL database.  So I killed off the old program and started from scratch.

A console app gets  the serial and logs it to a localdb table Then a windows app queries the database for the most current stats.  It allowed me with just a few queries to get the rain fall in the last 24 hours and high  and low temperatures for the same period.  I was having quite a bit of fun tweaking the console app to dump various weather stats.

The Downside of all this is the PC running is an ancient dual core athalon, When I bought it it had xp, in the mean time I migrated to WIN7 and then the fun started, with only the original 2 gigs of memory when I introduced sql server into the mix the system ground to almost unusability   Trying to get the console app to start (even compiled) took longer than the timeout on the query so it would error out, crash city.

I was astonished how much memory for this old box and its 184 pin DDR memory cost - For what 2 gigs cost I could get 8 gigs of DDR3 memory.  The cost of a decent machine was not in the budget so I bit the bullet and got 2 gigs to make 4 gigs on the machine.

Now I was in hog heaven - everything ran swimmingly even with tons of chrome tabs open and I went to bed and slept like a baby.

When I went to the machine this morning it was back to its old self and I  as more than a little miffed. I found the culprit soon after I opened task manager - Sql Server was using 1.9 gig of memory!!!  I know Databases like a lot of memory but this was a little excessive, in my mind.  Just to run a small table and a handful of queries.   Goggled a few Sql Server articles and that led me to the configuration item where the max memory usage could be set. Not being the least bit concerned about performance I throttled it down to 500 meg.

Now it seems like things have settled down and I am using a machine that has a modicum of performance again.

Now its back to making DLLs for COSM and Thingspeak, and polishing the code.

NOTE: in reality I am a software person, I only get enough hardware to let the IDE of the moment work.  I am definitely looking forward to my Raspberry Pi and all  the fun that is going to be.


Sunday, February 10, 2013

Battery Holders, Chargers, home brew gizmos.

Commercial Protected battery holder

The one thing that I thought I needed is a protected battery holder, since the batteries have  no protection circuit built in.  Plus some sort of keyed connector - when I got these on eBay, they came with the JST connectors sets - maybe it was a mistake since the listing doesn't mention it in the listing, but a welcome surprise.

Firecracker Battery holder


My first take at a battery holder. Kind of looks like a firecracker, doesn't it? Just took the battery and wandered around the local home supply store and tried different things. I love PVC, I found these gizmos that press fit onto the battery.  I scavenged some springs from an AA battery holder - drilled a hole in the end and ran the wire through.  Voila - dangerous, but serviceable. Made sure that it had all kinds of markings identifying which end is which. This plus a protector board, a JST connector will find its way outside to the weather transmitter.



The KahnFire Charger setup


The protection board in the circuit



And the charger


Added a trimmer to dial in the current for different batteries.  It's almost set to a short to get the 800 ma to charge the 18650s



A 18650 battery Charging fool

Fire Resistant Charge station
I have been having a seriously geeky good time the last week or so.  I have been filling my brain with everything Li-Ion and 18650 batteries in particular while waiting for the little pieces parts to show up.

Adafruit in their fantastic efficiency got me the charger in just a few days.  But it took a little longer for the "protected" battery holders to show up from China.  Two holders and two surprise sets of jst connectors had me down in the shop melting solder in minutes.

Since I trusted the Adafruit charger it got hooked up first. I think it was a mistake getting a 9v power pack for the charger - when charging the little  chip  gets quite warm to the touch.  The datasheet says the chip is thermally protected and will throttle back on the charging current if it needs to, not what you really want from a charger.  So I will dig around in the old phone charger box for the highest current 5v mini plug converter, less voltage, less heat.  Actually I do not care how long it takes to charge one of these  - I just sit next to the "fire resistant charging station" until the light blinks - about an evenings TV viewing.

It seems that most people use these cells to power flashlights.  Some of these flashlights have Cree LED and are driven at one amp plus constant current buck/boost switchers.  So having a 2200 mah battery for the hour or two run time you will need for this makes sense   However, even though I got a flashlight just to see what it is all about, I will be hooking these up to Arduinos and such which draw milliamps - I suspect that the batters will suffice me for a very long time - even if they are well past their useful life for high power applications.

Comment about Battery safety.  The charging part of the process is the most "dangerous".  I have read all the articles I could find about exploding Lithium batteries.  All of them I find are forced in some way, gimiked cells to cause an unstable situation, direct connection to a 12v car battery to an unprotected pack. These are unusual occurrences.

The thing that simply astonishes me is that people take batteries that have about the energy density of dynamite, that have elaborate safety mechanisms designed to outgas safely if some thing untoward happens.  Then they seal it up in a machined high strength aluminum tube without any safety overpressure blow out ports.  This is how to make a pipe bomb - not something that will take the abuse that a flashlight will over time.  When/if something happens - I will not be surprised, sorrowful and with heartfelt pity, but not surprised.

 I an good with the safety built into the cells, and the protection circuits I purchased, I can't make it any safer.  These batteries are safe if you don't go around poking them with sharp things or running over them, or something juvenile like shorting them out to just to see what happens, or putting them in high flying aircraft .  A little red and black magic marker to make sure I know which end is which, helps a bunch.

So I will use the same care I use with line level circuits / lasers/ gasoline / echant /  hypergolic concoctions.  I will pay attention to what I am doing, and never hurry. Nothing is so important that it can't wait until you are wider awake,  less stressed.......



More interesting details in next post