DIY IoT Project | Planning a trip to the Sierras using a Raspberry Pi | Part 1

Is it possible to plan a trip to the Sierra Nevada using a Raspberry Pi? The answer is yes. Before you pose the question: “why?”, you must take a look at this picture:

IMG_0780

Mono Lake, Eastern Sierra, California

Motivation for this project

The Sierra Nevada is one of the most beautiful places on this planet that I have ever visited in my life. My brother and I were traveling in the Eastern Sierra area (Mammoth Lakes – Mono Lake – Bishop area) during this Memorial Day weekend. We had to constantly monitor the road conditions in the area to adapt ourselves to the changing road conditions and we were thinking if we could use a Raspberry Pi to monitor road conditions.

If you are a DIY enthusiast like us and into building connected devices using the Raspberry Pi, you would be amazed by the volume of data made available by the state of California to the general public. The California Department of Transportation provides a RESTful API to retrieve road conditions, real time weather data etc. The state also provides files in JSON, CSV formats that contains messages displayed on road signs situated across the length and breadth of the state. These files could be retrieved to determine current road conditions across different parts of the state.

The Sonora Pass on State Route 108 (SR108) and Tioga Pass on SR120 are the two highest passes in California and a part of the scenic driveways in the Sierra Nevada. They are usually open between the months of May and November but remain closed under extreme conditions like gusty winds, snowfall etc. It is important to know if these passes are open to plan the road trip.

Investigation of available data

The CalTrans website provides information about the state’s road conditions on its website:

Caltrans

SR-120 road conditions

road_conditions

I was trying to find out if there is an API to retrieve current road conditions. I stumbled upon this site that provides the status of the road signs across the length and breadth of the state. The information includes the message being displayed at any given time and the last update status.

changeable_message_sign

JSON file of Road Sign Status + Message Being Displayed

I was trying to determine if I could make use of the status message displayed on one of these road signs to find out if Tioga Pass/Sonora Pass is open. For e.g.: A road sign on SR-120 would display the message — “Tioga Pass Open”.

I also learned that Caltrans displays a blank message on the road signs at random times of the day. For e.g. Caltrans displayed blank messages on all road signs in district 10 (Stanislaus and Tuolumne county) on May 31 at 8:41 p.m. At the same time, Caltrans displayed “Tioga Pass Open” in district 9 of the state (Mono County area).

I concluded that it is not a reliable way of retrieving the state’s road conditions. I accidentally stumbled upon this RESTful API call. For e.g.: A call to http://www.dot.ca.gov/hq/roadinfo/sr108 provides the current conditions on SR108 as follows:

Restful_api_calls

I was able to place curl requests on the command line terminal of the Raspberry Pi and retrieve the road conditions for different state routes.

Next Steps…

I have concluded that it is possible to retrieve road conditions using RESTful API calls. In the next steps, I plan to discuss the display of data in a format that is useful to travelers/photographers/hikers, building a device enabled by the Raspberry Pi, providing internet connectivity to the Raspberry Pi, power management, building a portable device etc.

We look forward to hearing your thoughts on this project, DIY approach to Internet of Things etc. We also would like to know if you know of any other data made available to the public by a state government.

Leave a Reply