Technology… huh?

Six words I’ve heard a lot these past several days are “No Grandpa, let me show you.” And here I thought that as Baby Boomers we knew more than a four-year-old.

Unspecting Baby Boomers

Julie and I are watching our ‘almost two’ and ‘almost five’-year-old grandkids while their parents take a well-earned vacation. Amongst the walks, playgrounds and library visits, “The Sound of Music” is available “on the blue ray player”. (I never had a blue ray player) Naive me was thinking that a ‘blue ray’ was like a VCR… no problem I told myself.

What the heck is a PS4?

It turns out that the ‘blue ray’ is actually a PS4 machine – a play station four. Whoever invented this darn contraption must have intended it as a torture device for Baby Boomers. First off, there are only two buttons on the box itself. I stared at it in disbelief until one of the grandkids uttered a version of that annoying phrase… “I got it, Grandpa” and magically, the box came to life. Now, how to start it playing the movie…

As I sat there staring at the PS-box, muttering to myself and pushing the non-power button I hear another version of – “That’s not what you do. Here, Grandpa, let me show you…”. With that, the almost-five-year-old picks up something that looks like a cross between a palm sander and a flight control for a spaceship and tells me to “just use the menu’. Like the box, this thing has no labels, just a bunch of ridiculous symbols. Some of the buttons have no labels at all. Another Baby Boomer torture device.

How does she do that?

In seconds, this ‘almost five-year-old’ flew through menus and has skipped ahead to the part that she wanted to watch. When I asked her how she knew to press ‘those buttons’, she gives me a confused look and says, “That’s just what you do, Grandpa.” Defensively, I tell her that I understand technology, but I’ve never used a PS-thing before. In what I swear sounded like a patronizing tone she tells me, “I know. It’s okay, Grandpa”. “No,” I say with a more defensive tone, “I worked with computers for over thirty years… I even wrote database interfaces in C…”. She patted me on the knee and asked if we could just watch the movie now.

I really do understand technology… really. I retired because I could, not because I got too old for the technology. Really.

Washington, DC Snow

We headed south to escape the cold and snow of Western NY. For our troubles we landed in the middle of the worst snow storm of the season in Washington, DC.

Our futile attempt to escape the snow of Western NY
DC Snow

Now, I have to say that this ‘worst storm of the winter‘ was nothing by Western NY standards, but it virtually closed down the District of Columbia. It seems that they have few plows here; the schools were all closed and the Federal government was shut down. Traffic on the roads was pretty light, so getting from our hotel to Monica’s home was relatively easy and having a snow day with the Grandkids was great.

On the other hand, snow on the first day of spring was not in my imagined version of our first week of retirement. It’s disturbing that my fantasy world of retirement is already crumbling on day-four. I’m hoping that clear skies are ahead!

Step Three – Hit the road

Yesterday we hit the road. Based on our experience trying to get out the driveway I have a few tips for the rest of you. First, think back to Step One (Move out of your house) and make sure you got rid of absolutely everything you could have.

We were loading the car up on Sunday, I’d already packed the car absolutely to the gills. Since there was definitely no more room, I walked back into the house. Julie was standing in her Mom’s dining room, arms crossed, surrounded by stacks of “stuff” on the floor. She announced, in a serious voice, “This is all that we have left to load…”

Step Three-A – Unload the car and start over.

Half the “stuff” we planned to take came back into the house since something had to give. We then started the process of again loading up the car, this time with a re-prioritized focus. Eventually, we managed to close the trunk and squeeze the doors to the back seat shut. For about the 50th time in the last six months, we asked ourselves, ‘where did all this stuff come from?’

Sunday night was the end of the first leg of our road trip and we’d made it 75 miles to our son’s house outside Rochester, NY. Those 75 miles sure seem like a pretty good start, as a result, we’re feeling very positive about our progress thus far. Let’s see what comes next.

Step Two – Leave your job

I woke up this morning with the same thoughts I’ve had for several weeks now – “What the heck are we thinking?!!”

  • We’ve already rented out the house and moved in with my Mother-in-Law
  • Today we both retire from our jobs

We’ve been saving for decades to get to this day, but something a friend of our’s (John Brewer) once said is stuck in my head. He once told us the transition from ‘working and saving’ to ‘retired and spending’ those savings is a tough one. Working to get past that hurdle is my first goal.

As things have it, today we each retired.  Both Julie and I have been fortunate to have great careers. We each count many of our coworkers among our friends – Julie at Citi Bank and me at M&T Bank. The various retirement gatherings this past week have been bittersweet celebrations as we’ve also said goodbye to many friends that we’ll only see infrequently as we move forward with our travel plans.

This evening and tomorrow we’re packing.  Sunday we’re striking out.  Our first major stop is Georgetown, DC and babysitting the grandkids.  We can’t wait.

Peru

Day 0 Arrive in Lima
Today was a long day. We should have known it was going to be one of unexpected events when our plane ran into problems landing in Atlanta. There was a ‘minor caution light’ that came on for the landing gear so the pilot calmly announced that we they took care of it (whatever that means) and that we were ‘going back around). We landed okay….
Then leaving Atlanta for Lima there was an ‘uncooperative pump’ issue that had us sitting on the ground in our seats while the issue was ‘addressed’. I suppose they brought someone in to talk to the pump about its behavior. In any event, the pump settled down and we were on our way. By the time we got settled in at our hotel in Lima it was either 1:30 or 2:30 in the morning… either way, it was late.

Day 1 Lima, Peru

Rise and shine! Anxious to see Lima, we dragged ourselves out of bed by 9:00 AM and headed down for breakfast. I could tell that Tim was still groggy because he was mixing in mangled Italian, French and German as he tried to communicate with the wait staff… everything BUT Spanish. Once he got coffee he was fine (sort of).

Carol Brewer stopped by and after satisfying our appetites we met in the lobby to plan the day. Through the hotel we scheduled a bus tour to Pachacamac, an Inca archaeological site south of the city. After spending some time exploring Miraflores, we had a quick lunch and headed for Pachacamac.

pachacamacb The Pachacamac archaeological site is about 35km south of Miraflores/Lima. The site is impressive with several pyramid temples, dwellings, remains of decorating adobe walls and other interesting constructions built by 4 civilizations. According to what we saw in the associated museum, Pachacamac was one of the most important religious centers of indigenous people at the Peruvian coast before the arrival of the Spanish.

We were all struck by the desert-like nature of the area and the dry air in spite of the ocean being so close. We looked at several temples in various states of restoration and the guide showed us a sample wall with layered illustrations. We also climbed a significant hill with the main temple atop it. That hill is set back about 500 yards from the ocean with a nice view. The last thing we saw before departing was the structure where the virgins were trained and kept under protection. You still can’t get close to it even today.

nikon-d5100-dsc_0337_1The city of Lima has grown in recent years until it not supports a population of 11 million residents. In the southern part of the city we saw scores of tiny three person micor-taxis, an enclosed motorcycle with two seats over a two wheeled rear axle. We didn’t see these vehicles in the Miraflores section of the city; apparently Lima has rules about where these vehicles could go and where they could not.   I want to mention that unemployment was quite low, despite the huge population.  Everywhere you looked there was someone cleaning the streets, watering the grass or picking up trash.  For such a large city the streets were quite clean.

Sunday Pictures- Album

Day 2 Lima, Peru

This morning we met our fellow travelling companions and our Globus tour guide, Adrian.  He gave us a great overview of the next week and laid out all the ground-rules for the group. nikon-d5100-dsc_0390An interesting fact he shared was that Peru contains 28 of the 32 world climates and it is 58% jungle.  That was interesting and highlighted how little Tim and I knew about this country. Adrian also warned us to wear our sunscreen, hats and to drink the coca tea when we moved to higher elevations the following day.  At that point we had free time until 2PM, so John, Carol, Tim and I headed out exploring.

iphone-6s-0046Lima is a coastal city, but sits on a pleateu several hundred feet above the ocean with sheer cliffs down to the water. Our first stop was the shopping mall at Larco Mar on top of the cliff. Just up the coast from the mall is the Parque del Amor, a park with a statue of two lovers kissing. An just beyond that park were these crazy people launching themselves off the cliff with para-gliding canopies. Out they when over the ocean, then they soared back over the land and quickly gained height! Awesome. Carol, John and Tim each signed up and took off out over the ocean and then over the buildings of Lima. Fortunately everyone made it back safely.

At 2:00 PM we all piled into a bus for a tour of the area.  Adrian took us to a local market where we tasted unusual (for us) fruits – some of which were very tasty.  We found out that Peru grows 3300 of the 11,000 varieties of potatoes in the world.  We visited a former monestary and walked through a large public area.  Adrian was extremely knowledgeable and informed us about the food, the structures, the economics, the climate, the people and the history of Lima and the country.  Peru is an interesting country with a vibrant culture. I couldn’t take notes fast enough.  Fortunately- there was no test at the end of the trip!   We were on our own for dinner (we had our first round of pisco sours.).

Monday Pictures – Album

Day 3 Cusco and the Sacred Valley, Peru

After a 5:30 wake-up call we’re off to the Lima airport and our first experience with the organization skills of Adrian. We quickly got through the crowds and checked our bags, then headed to the gate. Again at Cusco everything was organized for us. Organized as Lamas and Alpacas, we boarded our buses and headed for La Princesita and the Mother Earth Ceremony.

Shaman Lawda completed the Mother Earth ceremony before lunch. We each blew on her offering three times and then made a wish… After a delicious lunch, while enroute to Q’enqo, we learned that Eucalyptus was introduced into Peru in the 19th century. The site of Q’enqo is set on a hillside of erected and carved stone. Much of it is carved out of a naturally occurring monolith. Q’enqo is one of the largest and most impressive wak’as or holy places in the vicinity of Cusco.

Most of us were very tired and took a nap on the bus as we left Q’enqo on the way to our hotel. On the way we stopped in Pisac and visited a local market before heading on to the Sonesta Posada del Inca Yucay Hotel. After checking in, we had little time to rest before heading out to dinner and dancing horses. The meal was great, the horses entertaining and the trip back to the hotel was quick. We were all ready to hit our beds that night. This was a full day and we were all plenty tired.

Tuesday Pictures- Album

Day 4 Ollantaytambo and Machu Picchu, Peru

Finally, a day where we didn’t have to be up at four in the morning! This morning arrived with a nice cool sunrise. We all had time for breakfast at the hotel before boarding the bus at 7:30. The sun was just peeking over the mountains surrounding the valley as we headed north for the village of Ollantaytambo.

Ollantaytambo was an outpost for the Inca resistance led by Manco Inca Yupanqui after the arrival of the Spanish. When we climbed the many steps to the top it was easy to understand why they selected this place. It was still cool as we started exploring the town, but the temperature would continue to rise throughout the day.

The precise stonework in the walls of the village was amazing. No matter where you looked, the walls were set with precision that’s lasted for centuries. Our first stop was into the Guinea Pig hut, ranch or whatever. This smoke-filled stone structure had a thatched roof with an opening for the smoke to escape. After the small Guinea Pig roundup and rodeo was over we struck out for the rest of the town and the fortifications. But first, most of our group acquired the walking sticks that would be so useful once we got to Machu Picchu.

Along the way we caught a glimpse of a an image of Tunupa carved into the side of a mountain, and then our first direct view of the Terraces of Pumatallis. By now it was already warming up, so we grabbed our water and headed up the terraces… I can still feel that climb in my legs today. The views were incredible and the craftsmanship impressive. Even if we’d missed the Guinea Pig roundup, Ollantaytambo was well worth the time. I’d strongly recommend that you not miss this if you head to Peru.


After a short ride from the terraces we arrived at Ollantaytambo Station along the Urubamba River; we’d follow that river all the way to Machu Picchu. Adrian managed to get us all in one first class coach and we settled in for the ride. Along the way we had lunch and enjoyed the sights as Adrian pointed out the Inca trail and its hikers, terraced ruins and other points of interest. It was mid-afternoon when we made it to Machu Picchu Pueblo and we left the train, ready to head right up to the top.


Our bus took us up the side of the mountain with countless switchbacks. After the exciting 20-minute trip we still hadn’t gotten a glimpse of the ruins. Adrian organized us, got us quickly through the admission gates and we headed along the path. We rounded the last corner and suddenly there it was, right in front of us. Adrian announced, “You made it…, welcome to Machu Picchu!” It was awesome.

The pictures don’t capture the imagery. It was a beautiful, sunny afternoon with intermittent clouds providing an awesome backdrop for the peaks. We explored, listened to the local experts and soaked it all in.

We enjoyed another bus ride that would qualify for a Six Flags feature and we were back in Machu Picchu Pueblo. We checked in and gathered for dinner where the big debate centered on the weather for the following morning and who was going to take the 6 AM bus back up the mountain in the morning.

Wednesday Pictures- Album

PlatformIO for Arduino on Linux Command Line

So I had a challenge that required me to keep running up and downstairs as I was troubleshooting a new project. I’m having a problem with a temperamental water heater and decided to monitor it remotely. I have a photo-resistor taped to the water heater’s status LED and I use an Arduino Nano to capture and time the LED flashes and gaps. Then I send the results out the Nano’s USB interface to a Linux server I have running in the basement, conveniently close to the water heater.

Not having a laptop, I was using minicom to watch the USB traffic remotely from my desktop on the main floor of the house. Based on my observations of the USB traffic and minimal documentation on the Honeywell WV4460 temperature control, I’d come up with a programming change, take the stairs to the basement, disconnect the USB, pull the Nano and trek back upstairs to reprogram and flash it. While this started to become a chore, things got a little better as I employed a second Nano I had laying around. Now I’d reprogram the second board and just swap them. I still had to run up and down the stairs, but other than the device port changing every time I swapped out a board, it was a bit easier.

About the 10th trip back downstairs I had a thought. (First I thought – how many times is this gonna take to get it right…) My next thought was recalling that a while back I installed PlatformIO and Atom on my windows machine just to take it for a spin programming ESP8266 boards. Since it’s supposed to work with Arduinos and run on Linux so I wondered if it had a CLI. (My Linux server is CLI only with no GUI). Sure enough, it did and since I already have pip installed –
Sudo pip install -U platformio

The directory layout under Linux is the same as on Windows so I created an Arduino workspace named wheat_v3 (for WaterHEATer version 3) and initialized it.
cd ./wheat_v3
platformip init
platformio init --board=nanoatmega328

I then created a main.cpp in the src directory and did a quick copy/past of the Arduino native code, made some minor changes and saved it. Then from the ./wheat_v3 directory this is what my edited platformio.ini looks like:

[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
upload_port = /dev/ttyUSB1

I ran platformio run –target upload a few times and cleaned up a few errors. Once the issues were cleaned up I got a clean compile and upload! Now each time I need to make a change to the code on the Nano I just kill the server side application to release the USB port and compile/upload. This is so fast and easy you’ll love it if you’re interfacing a micro-controller with Linux.

Raspberry PI GPIO

On Raspberry PI I use the WiringPi library for both C and Python development. Below is an example of cycling through three GPIO pins to light up a set of LEDs.

  • GPIO 17 – Pin 6 maps to the WiringPi logical pin 0
  • GPIO 22 – Pin 7 maps to the WiringPi logical pin 2
  • GPIO 27 – Pin 7 maps to the WiringPi logical pin 3
[code lang=”c”]#include <wiringPi.h> int main (void) { int offset; offset = 100; wiringPiSetup () ; pinMode(0, OUTPUT); pinMode(2, OUTPUT); pinMode(3, OUTPUT); for (;;) // Loop continously { digitalWrite (0, HIGH) ; delay(offset); // delay ‘offset’ miliseconds digitalWrite(0, LOW); // turn off 0 digitalWrite(2, HIGH); // turn on 2 delay(offset); digitalWrite(2, LOW); // turn off 2 digitalWrite(3, HIGH); // turn on 3 delay (offset); digitalWrite(3, LOW); // turn off 3 } // Loop back and start over return 0 ; }[/code]

Compile using gcc:

#gcc gpiox.c -o wp gcc wpiox.c -o wp -lwiringPi

The ‘-lwiringPi’ tells the gcc compiler to use the wiring Pi library. Then run using…
#./wp

And watch the LEDs flash…

Wireless RFM69HW – Part II

Gateway Node

The weekend is here and another chance to start poking around with my new RFM69HWs. Here’s my plan. I initially want to get the gateway node connected to a Raspberry PI in my basement via I2C. (I know, there’s probably an easier way, but, hey – I’m doing this for fun and to get better understanding of how I can leverage these boards.) The Pi should be able to poll the gateway periodically to get updated temperature data. I’ll figure out the logging later, by MySQL and a basic graph should give me a good view.

anarduinoConnecting the Anarduino Gateway (GW) to the Pi is pretty straight forward. The GW uses 3.3VDC which is available on Pin 1 of the Pi. The I2C pins on the Pi are close by as well on Pin 3 and 5 with a GND pin just down the way at Pin 9. You can see in the image on the right that the 3.3 VIN and GND pins are on the same side as the analog pins; that makes wiring easy.  In the following table I’ve laid out the pin mapping between the Anarduino and the Raspberry PI.

[table “T1” not found /]

The heart of the code for the gateway is very compact. Lines 7-9 initialize the board with the defined frequency, network and node ID. These are configured with #define statements. In this case the board is 433 mhz, the networkID is 100 and this node is set as 2.


#define NODEID 2 // GateWay - each node must be unique
#define NETWORKID 100 // Same on all nodes that talk to each other
#define FREQUENCY RF69_433MHZ

[ccN lang=”c”]
void setup() {
Serial.begin(9600);
delay(10);

// RFM69HW setup
Serial.println(“RFM69HW config and setup…”);
radio.initialize(FREQUENCY, NODEID, NETWORKID);
radio.setHighPower(); // only for RFM69HW!
radio.encrypt(null);
Serial.println(“RX at 433 Mhz”);

Serial.print(“GPIO and I2C config and setup…”);
Wire.begin(SLAVE_ADDRESS); // initialize i2c as slave

// define callbacks for i2c communication
Wire.onReceive(receiveData);
Wire.onRequest(sendData);
Serial.println(“\nReady.”);
}

void loop() {
char inData[10];

if (radio.receiveDone())
{
memset(inData, 0, 10);
Serial.print(“#[“);
Serial.print(radio.SENDERID, DEC);
Serial.print(“] “);
for (byte i = 0; i < radio.DATALEN; i++){
Serial.print((char)radio.DATA[i]);
inData[i] = (char)radio.DATA[i];
}
if(inData[0] == ‘T’)
strcpy(cT, inData);
if(inData[0] == ‘B’)
strcpy(cB, inData);

Serial.print(” [RX_RSSI:”);
Serial.print(radio.RSSI);
Serial.print(“]”);

if (radio.ACKRequested())
{
byte theNodeID = radio.SENDERID;
radio.sendACK();
Serial.print(” – ACK sent.”);
}
Serial.println();
}
}
[/cc]

Lines 30-37 handle data from the remote node. Temperature data is prefixed with ‘T’ and battery data with ‘B’. Both are stored and delivered to the Raspberry Pi on I2C request. Next let’s look at the remote node.

Remote (Sensor) Node

Last week I added an antenna to each of the boards. This week I’ll design and build the remote temperature sensor. I selected a SparkFun TMP102 sensor; it’s small, fast and easy to work with. Because the remote node will be running on battery, I also wanted to add the ability to monitor the current battery output so I can (1) know when I need to replace the batteries but also (2) so I can optimize the configuration of the board to maximize battery life.

RFM69HW Anarduino Mini with TMP102 Sensor
RFM69HW Anarduino Mini with TMP102 Sensor

The two resistors act as a voltage divider with the resulting voltage compared to the internal 1.1v reference. Other than that you can see the connections are pretty straight forward with the I2C SDA and SCL pins connected between the sensor and the Anarduino.

Power consumption proved to be an issue as the remote node was rapidly chewing through the battery. I found a library (LowPower.h) that looked pretty good and installed it. SO far I’m seeing good results. Here’s the headers for the node:

Setup if pretty sparse with the reference voltage set to INTERNAL – 1.1v and the RMF69HW is configured. Because I’m not overly concerned about the privacy of temperature data I’ve set encryption off, however it’s nice to have this feature available. The RFM69HW supports a high-power mode which I’m using.

Wireless RFM69HW – First Steps

anarduinoA week ago I got a set of HopeRF Anarduino Mini RFM69HW boards in the mail. These boards are similar to an Arduino Pro Mini but have a RFM69HW wireless module mounted on them. They’re reportedly 100% Arduino IDE compatible and run at 8Mhz. The 6-pin header interconnect is an unpopulated set of six IO interfaces for FTDI type USB to UART (or similar) module or cable. The board also supports all the GPIOs you’d find on a similar Arduino board plus two additional analog pins, A6 and A7. You can see on the image here the FTDI headers and the four GPIO pins I’ll be using.

First things first, I soldered a set of straight male pains on the two GPIO interfaces and a set of 90 degree pins on the FTDI interface. After downloading and installing the RFM69 libraries I was ready to go. Then I connected a SparkFun FTDI 3.3VDC Basic Board to the FTDI interface, plugged in a USB cable and and fired up the Arduino IDE. Worked like a charm.

On the 1.6.4 version of the Arduino IDE you have to select the board, the processor and COM port. Initially I tried the Arduino Mini with no luck. After poking around on the internet I found a recommendation for using an Arduino Pro Mini setting and that did the trick. Once the IDE recognized the board I was able to compile and upload a demo program and soon had the two devices talking across the wireless link. However, as is normally the case with me and new hardware, there was a small problem.

The RSSI was running in the -110db to -115db range; not great if you want any distance at all. As I moved them more than a few feet apart the signal was lost. Like I said, not a good situation. I tried different orientations but they provided only meager success. With more poking around on the Internet I came across information on installing an external antenna. I ended up cutting a section of 24 ga solid core copper wire to 6 and 13/16th inches and soldering it into the antenna connection pint on the board. Wow, did that do the trick! I’ll get some more detailed information on that later. The short version is that it worked.

RSSI climbed to -10db and I was able to move the client node outside the house with no issue. Even at a distance of ~40’ though multiple walls I’m seeing -45db. Next step is adding a TMP102 sensor and battery pack to the setup. More to come.