SimpleCV…too fun

There are some great learning resources online to help get you started coding.  Before you try writing code in the traditional way, you might like to begin your journey into coding with fun visual exercises found on websites like Code.org and Google’s CS First.  Please watch these great videos and then use the links below them to start coding:


Kids talking about coding

President Obama talking about coding

Training in Computer Science:

Beginning coders

Folks with some prior experience

My family lives in Fresno, which is a fantastic place to live, except that our air quality is quite poor.  I’m sure you can look up how poor and why it is on your own.  I recently discovered that California’s Central Valley has one of the best air quality monitoring networks in the country!  Various agencies collect air quality monitoring data at stations throughout the Valley, including 7 stations in Fresno County and 3 in the City alone!  The stations provide data which is used to predict air quality for the following day at schools, and to support a Real-Time Air Advisory Network (RAAN), which posts hourly ozone and PM2.5 data to a webpage.  Every morning, schools raise a flag indicating the air quality for the day.  The predicted air quality index determines the color of the flag.

It seems odd to me that the school warning system is based on a prediction and does not change with the air quality through the day.  The diurnal cycle of smog production results in huge fluctuations in ozone, which can creep up to very dangerous levels, even on a green flag day.  The static flag system at schools does not inform teachers and parents of these trends.  I don’t think very many people are even aware that State and local agencies (public servants) are producing all this air quality data, and I doubt that most people have the means to look it up.

As a Arduino-equipped disciple of Christ, I can’t help but consider how all the wonderful data being gathered might be better utilized to serve our community, my low-tech neighbors in particular.  A couple of web queries later, I’m well on my way to building a Real-Time Air Advisory Network People-Alerting Machine (RAANPAM)!  I figure I’ll use python script on a computer to look up the data online and tell an Arduino UNO how to display the current air quality data on some sort of big display (like a big color wheel) and sound a horn.

So far, I’ve learned enough python (VERY little required, cuz python is AWESOME!) to grab data from the California Air Resources Board (CARB) website.  CARB actually has more data, like hourly NOx, than the local Air District.  Here’s what I did in python to download the current ozone data (screws up if no data has been posted yet for the day):

This is my first time using python, so let me know if you have any pointers for me.  The idea is simply to download the HTML files from the CARB website that have the air quality data we’re looking for, parse it out with basic string functions like find(), and then somehow deliver that data to the next step for further processing/decision-making.  I imagine there’s a better way to access CARB’s data (SQL database) that wouldn’t depend on CARB maintaining the exact HTML format they use today, but this seems to work right now.  Probably to minimize redundant data pulls, the air quality query results page includes all the data for each pollutant, day, and monitoring station as a comma-separated list in a link to graph the data – a really convenient single string to grab all the data I’m looking for.

# library with now() function for getting date and time import datetime

# library with urlopen() function for loading a web page
import urllib

# Get the current time as a string
now = str(datetime.datetime.now())

# Convert current time to three ints (month, year, day)
year = int(now[0:4])
month = int(now[5:7])
day = int(now[8:10])

# Create the URL that will load today’s CARB ozone monitoring data at the Fresno-First monitoring station
ozoneurl = “http://www.arb.ca.gov/aqmis2/display.php?param=OZONE&units=008&year=” + str(year) + “&mon=” + str(month) + “&day=” + str(day) + “&hours=all&county_name=10-Fresno&basin=–AIR+BASIN–&latitude=–PART+OF+STATE–&report=HVAL&order=basin%2Ccounty_name%2Cs.name&submit=Retrieve+Data&ptype=aqd”

# Get a file-like object for the ARB web page with today’s ozone data.
f = urllib.urlopen(ozoneurl)
# Read from the object, storing the page’s contents in ‘ozonehtml’.
ozonehtml = f.read()

# GOAL OF NEXT FEW STEPS: Find and store the latest ozone data for processing

# Find the comma-separated ozone data (starting/ending place in the HTML)
# (the file has it embedded in a link to plot the data – pretty convenient!)
ozonedatafinish = ozonehtml.find(“Fresno-1st Street,3009″)
ozonedatastart = ozonehtml.find(“value=’”, ozonedatafinish – 500, ozonedatafinish) + 7

# Store the comma-separated ozone data
ozonedata = ozonehtml[ozonedatastart:ozonedatafinish]

# Show the data!

The other day I posted about progress on an aerial photography project.  At the end of the day, my auto-picture-snapping circuit didn’t work.  It’s my first project using a 555 timer (NE555P).  I finally measured the capacitance of the timing capacitor and found it was WAY smaller than I’d thought.  The circuit output seemed to be always high because the frequency was really high.  This also explains the low voltage (averaged over duty cycle)!  I swapped the capacitor with one closer to my design and it flashed LEDs just right!  When I connect the camera up to the MOSFET (2N7000) that is controlled by the output of the 555, I got pictures!  Woohoo!  You should have seen my excitement when it finally worked…actually you can!

it works!

I wrote this email to Berean tonight regarding the back cover of its Summer Catalog.  When I first saw it, I didn’t even believe it was real!  I wonder how much more I would take issue with Berean if I actually looked inside the catalog!?


I can’t help but complain about the product advertised on the back of the Summer catalog. As a Christian, I feel I have to speak up when it seems that someone is blatantly misrepresenting Christ to a vulnerable audience. In this case, Berean is potentially distributing walking billboards that misrepresent Christ on a large scale. The t-shirts advertised on the back of the catalog clearly confuse the place of God and country. They fan the ethnocentric and jingoistic flame that threatens to burn down proper boundaries between loyalty to Christ and loyalty to America. They are fuel for the fire that already burns perilously close to Christian leaders and too many of our brothers and sisters.

I know some Christians hold the opinion that this country was founded on the Word of God, but the t-shirt that uses Isaiah 53:5 to essentially imply that America is our messiah is just disturbing. It really bothers me that Berean would feature this kind of advertisement so prominently on the catalog.

Thanks for the opportunity to comment.

Steve Popenoe

Write Berean your own comments if you have some ideas: customerservice@berean.com

Since our church is not too strong in the revenue department, we try to get creative with fund raisers in order to bring as many people as we can to camp.  This year, we collected stuff for a yard sale and did pretty well.  Our enchilada sale was a success, too.  But we’re still coming up pretty short.  I got the idea to sell personalized aerial photographs that we could take using a tethered balloon.  I’m still not finished with the setup and camp is this weekend, but I think it could be a pretty good little racket.

The plan is to get a cheapo camera that I can wreck without too much heartache (craigslist camera – CHECK!) and send it up with a helium balloon and a picture-taking circuit.  I estimated (assuming ideal gas law and spherical balloon) that a 36-inch balloon could lift about a pound.  I found a website with 36-inch balloons six for $10.  This seems so easy and simple!

I spent a few hours in the middle of last night working on the picture-taking circuit part.  I made progress, but in the end I was pretty disappointed.  I was able to crack open the camera after an hour of ridiculously excessive straining with the wrong-sized screwdriver.  I poked around with some wire to figure out which metal pieces need to connect to trigger the shutter.  Then I soldered wires onto each side of the connection that worked.  After running the wires out of the camera and closing the camera back up, I tested it out by touching the loose ends of wire together and BAM!  There you go – it worked!  This is great, because now it should be really easy to trigger photos with an easy-to-generate signal from a simple circuit or a microcontroller like the Arduino!

I recently bought a hundred 2N7000 MOSFETs from Jameco.  It seems to me that one of these is perfect as a switch to short my two shutter-control wires together.  I also bought a hundred 555 timer chips…because I’m crazy.  But one of these should come in handy to send a shutter-control signal to the MOSFET switch every few seconds when the camera is in the air.  I referenced a handy LM555 calculator website to build this circuit (powered by an ATX power supply for testing):

555 timer circuit for camera shutter control

I tried to size the resistors and capacitors for the 555 timer to generate a periodic square wave signal with about 0.15 seconds of “on” followed by 15 seconds of “off”.  It didn’t work!  When I tried it with 5V supply, my multimeter shows what seems to be a constant 1.9V output from the 555 (Vgs on the 2N7000), which results in a partially on MOSFET with channel resistance around a k-ohm instead of just a couple of ohms.  With 12V supply, I get Vgs of 6V but it seems to have 100% duty cycle (the “pulse” to signal the camera is always on).  I might as well not have a 555 chip in there – no good.  This is the point in the story when I realized the sun had come up and it was time to go to work.  Will need to face this later, as well as the issue of supplying power at 5V or higher when the camera has a 3V supply.

Family Camp


Our church is holding its annual Family Camp this weekend.  We head down to The Oaks (a World Impact camp) each year for time together in a quiet place where we might connect with God in a different way, far from the noise of the city.  Every year it results in a resurgence of life, a new vitality in folks that come.  This year our focus is on the journey of life.  We hope to encourage each other to press on, despite all our struggle, to finish – even with joy in our hearts and smiles on our faces as we bear each other’s burdens.

Please pray with us that God will bless the trip.  There are always dark areas that need light.  There are always wounds that need healing.  The problems are always bigger than we can handle.  In His mercy we find our help.  Woohoo!

Another Murder


In less than two months, another man murdered within sight of my front door.  Oh, Lord!  I don’t even know how to pray!  This time I almost skipped sadness and went to anger.  I’m so frustrated!  What the hell are you guys doing killing each other!  Firing bullets, spraying blood less than 100 feet from sleeping children – for what!?  I’ve felt like our neighborhood has been steadily transitioning from a relief-dominated area to more of a development mode.  With the relative peace of the last couple of years, more of us have felt encouraged to focus on the quality of life in our neighborhood, even doing more minor things like street cleaning and planning a community garden.  Maybe this effort has added another coat of rosiness to my rose-colored glasses, but I am shocked by these last two killings.  I’m dissappointed.  To have people murdering each other so close to, even right in the midst of an extraordinary density of people who, as Christ has done already, would lay down their own lives to create an alternative to the path of darkness, pain, and death they’ve chosen!

I searched for “In your mercy, Lord, hear our prayer” and found some beautiful language we can bring to the Father.

O God, who brought us to birth,
and in whose arms we die,
in our grief and shock
contain and comfort us;
embrace us with your love,
give us hope in our confusion
and faith to persevere;
through Jesus Christ.


Getting Organized


Lately I’ve been using this WordPress thing to keep track of some ideas.  I haven’t used it much, but I’m already thinking it’s really powerful.  I also tested out some mind-mapping software, namely Freemind, which is a great way to plan or take notes, but I’m finding it’s not that cool of a way to keep track of references or tie related thoughts together like WordPress.  It seems to have limitations similar to conventional hierarchical file systems on a computer.  I understand that it’s difficult on a flat screen to present data in more than two or three dimensions in a readily understandable way.  But the computer should not be limited in its actual organization of the files to two dimensions!

I’ve been thinking about how to develop a Wiki to organize the resources we rely on as the scientific basis for water quality regulations at work.  It frustrates me that much of the reference material upon which our office depends is scattered across multiple storage areas and records of the documents’ location and proper use are primarily kept in the minds of the most experienced individuals.  I’ve organized the material I’ve accumulated electronically over the last three years into a standard directory structure on my computer.  It’s pretty well developed, so I have general categories and multiple subcategories of subcategories, etc.  Every time I find something I think I’d like to add to my collection, I struggle with where to place it.  I’m afraid it’s getting very difficult to find items that could be categorized multiple ways.  For example, a document that helps interpret water quality analytical lab results might focus on effects on crops and be categorized with agricultural resources, but because of it’s information on petroleum hydrocarbons might be well-placed with underground storage tank information.  I started creating links to some items at the ends of multiple paths I expect I might take in searching for them.  When I reorganize or consolidate directories, the links are broken.

What I’d like to see in a note-taking and reference tool (which I think should be a primary function of a personal computer) is a relational database that you can use to connect objects to multiple other objects (more like a neural network, I guess).  It’s great to have categories and subcategories that you can drill down into like in a conventional file system (and associating an item with a subcategory automatically categorizes it with the parent!) but the ability to assign multiple categories to a single item is also very important in order to allow multiple paths to find the item being sought after.  It seems like this is more like we organize data in our minds – in some kind of spatially impossible interconnectedness, a multidimensional database than can spit out projections of data in fewer dimensions according to user demands.  It’s fun to think about other ways that this kind of data handling system allows mind-like function…but I should move on to higher priority thought.

It kinda seems silly and useless that I wrote all that, but I guess it helped me to build understanding of what I am looking for and realize that the Wiki and other social media software that implements relational database concepts may be a good fit for me.  Kind of like how carefully considering how a wheel makes it easier to move heavy loads might help us to understand the wheel enough to think of how best to apply it to our own situations.

A man from our community was beaten to death across the street from our apartment a week ago on Wednesday.  Folks around here knew him as Spooky.  I didn’t know him, but his death has really shaken me.  I’ve kinda channeled my mind into insignificant minutia as a coping mechanism, it seems.  As I walk the streets in the morning and at night getting to and from work, I sense a disturbing quietness.  It’s like none of us knows what to do; how to mourn or respond at all.  I have that elephant-in-the-room feeling even when I sit alone inside my apartment.  I pulled out one of the big 4×8 corrugated plastic political signs I harvested back in November to create some kind of public expression of mourning and maybe a statement on behalf of Jesus against violence on our streets.  I don’t know what to make, what to express.  I saw the police take my neighbor away today, though I don’t think he was “involved.”  Tomorrow we’ll meet with some brothers and sisters to pray on the street.  Maybe then we can process this together.  Lord have mercy!

What can make us whole again?  Nothing but the blood of Jesus!  This is all my hope and peace!  Nothing but the blood of Jesus!  Oh, precious is the flow that makes us white as snow!

I hear shots firing right now.  Father, may your Kingdom come and your will be done on Earth as it is in Heaven!