Hastily written and ready to scare you with its need for refactoring…
See the code on Open Processing
It is one of THOSE blog posts. The apology for not having written in awhile, the promise to be better… well, maybe not that part. I promise to be better starting in January. In the mean time I’m having my ass kicked by trying to develop a community college targeted curriculum on electronics that incorporates that hands on Fail, Fail, Fail, Win ethos from the hacker and maker communities.
The TL;DR for this post: All I really want to do now right now is spend some time writing some gcc compatible C++ code to upload to my ATTiny85 with AVRISP programmer, because all of those words actually mean something to me.
For those of you who don’t know, I am one of the founders of the hackerspce CRASH Space. Part of CRASH Space’s mission is education, and I am very proud of the work we’ve done on that front. When the opportunity came up to spread some of that love to Pasadena City College, I jumped at the chance. They already have an awesome DesignTech program that feels like home.
Community college teaching combines nicely with the hacker ethos because community colleges focus on folks finding alternative paths to learning than the one classically accepted by society. The students in my room range from the young and determined to succeed to the older and determined to stay curious.
The broad range of life experiences in the room enriches the experience for everyone.
I haven’t shared a lot of the work I’ve done at PCC yet because it all feels very much in the alpha stage. After finishing this semester I’ll start putting up some of the projects, etc.
One of my frustrations is that I couldn’t find an existing cohesive curriculum with lesson plans that tolerates differing Math and English skill levels targeted at ADULTS. It seems you either know calculus already, don’t really care about actually making anything, or are a child. The ones that are close live behind copyrights that make them hard to adapt appropriately.
Also, what I mean by curriculum now is not what I would have meant by curriculum 10 months ago. What has to be developed to create a state-certifiable curriculum amounts to some pretty insane documentation. I feel a bit like I’ve moved into bizarro world as some of the “New!”©™ fads seem painfully obvious, although incredibly well intentioned.
Here is a list of some of the information I’m preparing:
The really sad part is that all of these need to be written in a joy-sucking form of English that seems geared towards convincing administrators that no fun will be had by students ever. It’s weird. Oh, and did I mention that this all had to be done before even a single course can show up in the course catalog? Talk about the opposite of release early, release often.
I mean, I guess this is all a good thing. The new deliverables represent a desire on the part of schools to update their methodologies and increase accountability. (<-yup, it all sounds like that) I feel the most comfortable with the Assessment Plan part, where time gets budgeted to revise what the students are doing based on data collected from the students. The Ex – Human Factors Professional in me likes that part a lot.
And I’ve learned something about myself. Turns out, I am an advocate of flipped classroom, project based learning based on open source tools within a mastery/competency/proficiency based framework of promotion. Which apparently makes me pretty radical. I can live with that.
<UPDATED 10-28-14>Added the bit about the three domains of learning</UPDATE>
But don’t ask me anything, because I passed by the skin of my teeth (and giving legal advice without being a lawyer is illegal.). Apparently lots of coffee does not replace actually having gone to law school.
I started teaching at Pasadena City College during the course and that definitely impacted the amount of time I had to study. However, without question the experience is worth it. If you want to be kept posted as to how to enroll in the next one sign up at http://copyx.org/get-involved/
So it is time for me to start putting up presentations as I do them. I make highly visual slides without many notes, so I’ve assumed they wouldn’t really be useful to anyone else. However, I did a quick talk at the Intel Experience store in December. It came up that someone wanted to see them, so I’ve posted my first deck to Slideshare.
I use Keynote so the slides posted are a PDF export.
The talk covers:
How fast and how cheaply can test equipment be made? Two can be made for less than 5 dollars, an hour of time and a glass of wine with my sweetheart. A great Wednesday night.
“Real parts” like a battery holder, mini buzzer and alligator clips along with wire with some solder can be had from the local Radio Shack, but that is way more expensive. Biggest tip, keep the circuit under 3 Volts. For testing sensitive circuits, it will be time to uplevel.
NEW! There will be a Part 7. I’m splitting the wrap-up off of this post. The last few posts have been very unphotogenic and I have one last unphotogenic step to get through before the step with more to see. Instead of burying the pretty, I’ll give the project glamor shots their own day.
This installment will only cover changes made to the getEmailCount() function needed to finally read the file I could now make on the SD card.
Sadly, even once a file with a number in lived it on my SD card, the code from the sparkfun Intel Galileo tutorial still wasn’t working for me. I changed a whole bunch of things before rechecking it, so I still don’t know what fixed it for sure. Bad troubleshooting hygiene, I’ll admit. A better me would go back and recreate the error, but I don’t have time.
When I ran the code I was seeing a null value in the int that was supposed to be holding the quantity of emails found in the inbox. That int derives its value from each of the ASCII characters in the text file on the SD card being passed into an array. Some processing then needs to happen on those characters and/or the array to finish the transformation of a String into an int.
If that paragraph made no sense, the following links are a place to start. I picked them because they all discuss serial communication. During serial communication information is passed between computers and the protocol has to be really clear about what format the data moves around in. This makes the topic a good one introduction to thinking about swapping data between two programs running on the same machine as well.
To be clear, Jim Lindblom has a clever approach where he converts each ASCII digit into its int value by subtracting the ASCII value for 0 (48) from each byte read from the txt file (line 118). He then implements a for loop to step through the array those int values had been placed in, multiplying each value by the appropriate power of ten so their sum would equal the correct number of emails (line 125, 126). This demonstrates a valid and very Arduino community friendly approach because it requires no functions outside of the Arduino reference guide.
Seriously cranky at this point, I chose the less friendly but simpler to me path of loading the text digits into a char array, adding a NULL termination to it and then using the c function atoi() in lieu of the for loops. Keep in mind, the word “string” in C documentation usually refers to a null-terminated char array not an analog of the Arduino String object.
This function worked!!! Happy Dance! Ready to move the shield over from the Uno to the Intel Galileo! Yay!
I am excited to announce a last minute gig teaching the second half of an electronics class at Pasadena City College. My first impression of the students is wonderful. In our first class together, they asked for more homework. More! Homework! I can do that.
We have a tumblr that is coming together on the fly: http://pcceltn130.tumblr.com/
I’m taking a stab at a flipped classroom with Standards Based Grading, since honestly it seems the fairest under the circumstances. As a result I’m spending a lot of time watching youtube videos to find ones that fit the curriculum. The long term goal is to recruit future students to help make more tailored videos. Also… the one standards spreadsheet to rule them all is taking up a lot of cycles. The link will allow anyone to comment. Google sheets does not have spell check, please forgive.
I have not forgotten about the Intel Galileo Board Part 6. I’m behind the curve now on class prep, so that blog post has slipped priority for another week.
This is part 5 in the series of my getting to know the Intel Galileo Board. I made a project that uses pager motor based bees which buzz louder based on how much email is in my inbox. This is a derivative of the SparkFun Enginursday project that uses an LED display to show an unread email count.
This section chronicles the work done on Linux core itself. The Galileo has an x86 processor, the Quark X1000 SoC, a 32-bit, single core, single threaded, Pentium ISA-compatible, max clock rate 400MHz CPU. Other folks have played around with installing other flavors of Linux, but I am using the official Image. The ability to use a more robust processor while still in the Arduino ecosystem is one of the major selling point of the Intel Galileo. This week is mostly piddling around in the Linux file system. The next installment demonstrates how to harness the power from an Arduino sketch.
The following post assumes some knowledge of *nix systems and elementary Python. Those with zero Linux knowledge, zero Python knowledge and zero Arduino knowledge might want to pick one to get comfortable with first. I’ve presumed Arduino knowledge thus far, and will assume some comprehension of the other two. I recommend the following to skill up:
Before placing the mail checking script on the SD card:
Given that there is no way to attach a keyboard, mouse or monitor to the Galileo board out of the box, another root to see inside the Intel Galileo’s brain has to be found. The cracks in the side of the mountain are:
I only have direct experience of the first two.
Having the appropriate serial cables and a terminal emulator is the most bullet proof method of talking to the Galileo. It does not require the Arduino emulator to be running a specific sketch or even for that feature to be running at all.
I’ve uploaded my terminal settings. The port name will need to be changed depending on what USB to serial adapter driver you have installed.
After making the connection, if the Galileo is already booted, nothing will happen in the terminal window. Hit return and a login prompt will show up. The login name is root. There is no password.
For future use, once the connection is made, even without login, all of the debugging messages during start up and sketch upload come streaming out this line. Access to those messages alone justifies spending the money on an adapter.
If you have SSH‘ed into something at that was assigned that address on your network before a RSA key warning will appear. The best course of action is to delete that IP address’s entry in your known_hosts file.
Once in, you are free to move about the system. I suggest changing the password, especially if leaving your Intel Galileo connected to a network.
#####CHECKING FILE SYSTEM #display free disk space (df) df -h #change directories to the alias for the Arduino storage cd /media/realroot #now that you are actually somewhere with files the #ls command will work and show the test files from #working with the SD library if there are any. ls -l #####END CHECKING FILE SYSTEM
Congratulations, you’ve hacked your personal Gibson.
The Python script won’t work if it can’t see the internet and the mail server. Make sure WifiChecker or some other WiFi enabling Arduino sketch is loaded. Then try some of the commands below.
#####CHECKING INTERNET #ping googles DNS Server to see if internet is working ping 184.108.40.206 #googles DNS Server ^C #get a web page, if ping works, not all that necessary telnet google.com 80 GET / HTTP/1.0 #<return> #<return> #check that the mail server responds ping YOUR.MAIL.SERVER.COM ^C #is SSL possible on the mail server SSL port telnet YOUR.MAIL.SERVER.COM 993 #IMAP SSL #an alternate way to get IP address if didn't #use WiFiChecker ifconfig #####END CHECKING INTERNET
Python 2.7.3 comes with the Galileo SD image. Checking the basic functions takes just a few commands.
#####CHECKING PYTHON # get the version python -V # launch python interpreter python #run the len() command as a simple test len("I should return 18") #leave python interpreter ^D will also work exit() #test the ability to run the test script #will only work if you've actually copied #the test scrip to the SD card. python test_return18.py #####END CHECKING PYTHON
The fully updated Python script should be on the SD card ready to run. Hopefully a simple call while inside the /media/realroot directory will run beautifully for you and no more will need to be done.
That isn’t what happened for me. Running the script resulted in a fatal socket error.
File "pyMailCheck.py", line 5, in <module> obj = imaplib.IMAP4_SSL('mail.MYSERVER.com', '993') # Connect to an IMAP4 sever over SSL, port 993</pre> File "/usr/lib/python2.7/imaplib.py", line 1148, in __init__ IMAP4.__init__(self, host, port) File "/usr/lib/python2.7/imaplib.py", line 163, in __init__ self.open(host, port) File "/usr/lib/python2.7/imaplib.py", line 1160, in open self.sslobj = ssl.wrap_socket(self.sock, self.keyfile, self.certfile) File "/usr/lib/python2.7/ssl.py", line 381, in wrap_socket ciphers=ciphers) File "/usr/lib/python2.7/ssl.py", line 143, in __init__ self.do_handshake() File "/usr/lib/python2.7/ssl.py", line 305, in do_handshake self._sslobj.do_handshake() socket.error: [Errno 104] Connection reset by peer
The error implicated the second line of code, the fifth line of the file. The script had worked perfectly for me from my computer. My approach was to launch the Python interpreter on the Galileo board and test it line by line. Indeed, line two was the problem. My code uses a custom mail domain via Dreamhost. The SparkFun code was tested with a gmail server. Turns out this code works perfectly from the Galileo when the mail server is a gmail server, but not my mail server. Doh.
I suspect the suggestions on the Dreamhost wiki page about Certificate Domain Mismatch Error hold they key, but I’m not 100% confident. Since I’m using a disposable email address for a temporary project, my workaround in the short term is to do the VERY BAD NEVER REALLY DO THIS sending of the password in the clear which allows the Galileo to connect to my webserver just fine.
obj = imaplib.IMAP4('mail.YOURSERVER.com') # Connect to an IMAP4 server. Password CLEAR TEXT
More sadness, for me the Arduino code STILL didn’t properly read the numbers from a file after getting the Python script sorted out and confirmed functional.
The next task required troubleshooting code written to read the numbers in from a file. And that will have to wait until next week…. but so so so close…
This is a collection of resources about Data Visualization for Learn To Code With Us March 2014.
These are tools that let the user create their own visualizations. They are also good sources for inspiration and DATA.
carlynorama is Stephen Fry proof thanks to caching by WP Super Cache