carlynorama

the blog

I passed CopyrightX!

by Carlyn Maw on June 13, 2014, no comments

image of certificate indicating that Carlyn maw completed CopyrightX

I passed CopyrightX and what I got was a PDF (and a ton of useful knowledge)

 

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/.

LA Hackerspaces and Intro to Arduino talks slides up on Slideshare

by Carlyn Maw on April 21, 2014, no comments

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:

  • “What is a Hackerspace”
  • “What are our local Hacker/Maker spaces?”
  • “What kind of projects can I learn to make?”
  • “What are some Arduino Basics?”

Quick Continuity Testers From Dollar Store Parts

by Carlyn Maw on April 3, 2014, 2 comments

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.

Flickr API error: SSL is required

“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.

Intel Galileo and Bee Mail Part 6: c string to int on an Arduino

by Carlyn Maw on March 31, 2014, no comments

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.

Strings to Ints

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.

Celebrate Good Times

This function worked!!! Happy Dance! Ready to move the shield over from the Uno to the Intel Galileo! Yay!

In this series

  • Part 1
    • Overview
  • Part 2
    • From Zero to Blink.
    • Creating an SD card image and getting a sketch to persist on the Galileo
    • UPDATE: Blink on an external LED
  • Part 3
    • Creating the bees and getting them to work on an Arduino UNO
  • Part 4
    • Setting up Wifi (very easy, library examples worked immediately)
    • Getting the SD card read & write to work (a missing libraries/symlink problem)
  • Part 5
    • Serial Communication to the Linux Core
    • Troubleshooting Python on the Galileo
  • Part 6 (this post)
    • Revising the String to Int code
  • Part 7
    • Motors moved to Intel Galileo
    • Conclusions
    • Next Steps

Big Thumbs Up on the Mike Kelley Exhibit @ MOCA

by Carlyn Maw on March 30, 2014, no comments

Mike Kelley, 03.31.14 – 07.28.14, Geffen Contemporary

More from last year’s memorial

New gig teaching at PCC or “Where’s Part 6, Carlyn?”

by Carlyn Maw on March 25, 2014, no comments

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.

Intel Galileo and Bee Mail Part 5: Troubleshooting Python in the Linux Shell

by Carlyn Maw on March 13, 2014, no comments

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.

Before You Start

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:

Add these files to the SD card

Two files, the SparkFun mail checking python script and a test script that always returns the number 18, will aid in the trouble shooting. Put them on the SD card before getting started to save time.

Before placing the mail checking script on the SD card:

  • swap in appropriate email credentials for the dummy text
  • check that script successfully negotiates the mail connection and returns the correct value from a computer
  • place the python file with the credentials on the SD card of the Intel Galileo board.

Options for Talking to the Linux Kernel

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.

Use the special RS232 to minijack serial cable

CoolTerm Settings

CoolTerm Settings

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.

For software, on the Mac I use either Cool Term or  the screen utility.  The hardware I needed:

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.

With WiFi

Run WifiChecker. The code has the Arduino tell you its IP address via the Serial port.  Open a Terminal program and establish a connection to the Intel Galileo Board by typing:

ssh root@INSERT_IP_NUMBER_HERE

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.

First things first

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.

Next look at the directory structure, not with ls (show me the files) but df (show me attached hardware).

#####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.

Check The Internet

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 8.8.8.8 #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

Check Python

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

Troubleshooting the pyMailCheck.py Script

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.

python pyMailCheck.py

That isn’t what happened for me.  Running the script resulted in a fatal socket error.

File "pyMailCheck.py", line 5, in &lt;module&gt; 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

Home stretch…

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…

In this series

  • Part 1
    • Overview
  • Part 2
    • From Zero to Blink.
    • Creating an SD card image and getting a sketch to persist on the Galileo
    • UPDATE: Blink on an external LED
  • Part 3
    • Creating the bees and getting them to work on an Arduino UNO
  • Part 4
    • Setting up Wifi (very easy, library examples worked immediately)
    • Getting the SD card read & write to work (a missing libraries/symlink problem)
  • Part 5 (this post)
    • Serial Communication to the Linux Core
    • Troubleshooting Python on the Galileo
  • Part 6
    • Revising the example String to Int code (lack of Null Termination problems)
    • Moving the motors over to the Galileo

Data Visualization – A Survey of Resources

by Carlyn Maw on March 6, 2014, no comments

This is a collection of resources about Data Visualization for Learn To Code With Us March 2014.

Books (Overviews)

Videos

Online Tools (non programmer friendly)

These are tools that let the user create their own visualizations. They are also good sources for inspiration and DATA.

  • Visualizing.org : “A community of creative people making sense of complex issues through data and design”
  • Many Eyes :  “This site is set up to allow the entire internet community to upload data, visualize it, and talk about their discoveries with other people. “
  • Gap Minder : “Fighting devastating ignorance with fact-based worldviews everyone can understand.”
  • plot.ly : “Plotly is a collaborative data analysis and graphing tool.”
  • An article listing 33 tools 

Software Development Tools

Examples

Intel Galileo and Bee Mail Part 4: Working with Libraries

by Carlyn Maw on March 3, 2014, 4 comments

This is Part 4 of creating the BeeMail project. Previously I got the Galileo up and running, designed the Bees themselves and built the motor circuits. See the Table of Contents for this series at the bottom of the post.

“All” that was left was to rework the code in the example project to suit my own purposes. Sadly copying and pasting the code as written caused all. sorts. of. error. messages. None of which I understood yet.  Since the project has many intermeshed systems, most of which were new to me, Jim Lindblom’s work became a todo list / starting guide. Troubleshooting is all about isolating variables.

My ToDo list looked something like this:

  • Is the WiFi Working?
    • Is the WiFi hardware recognized?
    • Is the Wifi Connected to the network?
    • Can the Galileo get out to the internet?
  • Can I see the SD card?
    • Does the SD card initialize?
    • Can the Arduino sketch create files?
    • Can the Arduino sketch add content to files?
    • Can the Arduino sketch read files?
    • Can the Arduino delete files?
  • Does the Python Work?
    • Does Python run at all?
    • Can the shell see the internet / is my mail server available to it?
    • Does my Python script work on the Galileo?
    • What does the output look like of the Python script and where is it putting it?
    • Is the sketch calling the Python script successfully?
    • How is the Arduino sketch interpreting the output file?
  • Add in the bees.

The first to sections are covered in this post with a lot of long code includes, so I’m putting them after a break.

more →

SyntaxHighlighting Evolved WordPress Plugin and a Custom Arduino Brush

by Carlyn Maw on February 28, 2014, one comment

Screen shot of a render of example code using SyntaxHighlighter and my Plugin

Example code using SyntaxHighlighter and my Plugin

I’ve been using github gists fairly heavily because of not wanting to bother to with code highlighting plugins since moving to a self hosted WordPress blog.  I finally got sick of that tonight while watching my site be suuupppperrr slow loading because of a call to gist.github.com. This right after writing a tiny little gist that no one will care about outside of the post for the next section of the Intel Galileo write up.

The consensus seems to be that SyntaxHighlighting Evolved is the go-to plugin, although Crayon looks pretty great. Since Arduino language recognition is not included in the default package, I wrote my own plugin to add Arduino highlighting to SytaxHighlighting Evolved and put THAT on github. This seems like an easy way into plugin development. I’ve submitted the plugin to WordPress.org and will update this post if it is accepted.

Things to look into:

  • One of the tutorials has heavier and lighter versions of its formatting… could that be a setting?
  • Can the colors be updated via a setting page?

Places I learned from:

carlynorama is Stephen Fry proof thanks to caching by WP Super Cache