Summer Update! Studying and Troubleshooting, Oh my!

Let’s just say summer is in full throttle heat mode here in Florida. I’ve been a busy baking bee making sweets and decorations for my daughter’s never-ending birthday festivities, which was fun, but I’m glad to be back to the study realm! And the unbearable heat makes a perfect excuse to hide indoors, study, and work on some projects.

Team Treehouse Learning Update

I’ve resumed where I left off in the Python Track and I’m actually happy I didn’t finish this track earlier because Team Treehouse has recently released an update to the Python Track. At first, when I was in my previous track (Python Collections, which is now retired) I found myself losing some steam. I thought perhaps it was me, but, considering the revision, maybe there was something a little off with that former course layout. The new course layout, so far, has been wonderful! It did take me back a bit, relearning some stuff I had already went over, such as tuples and slices, etc, but I could definitely use the repetition since I’m newbie.

Funny enough, my daughter and I are exactly the same type of learner (that I can see so far). Just like her, it takes me a few days for information to really sink in. But, when it clicks, it’s magic! When I finally returned to the python track after a little break, I found that the break was very beneficial and I’ve been able to complete the quiz questions without reaching out to the community for help, which is a very rewarding feeling!

Advanced Interests

Although learning the basics is super exciting, this field is so vast and plentiful that I have been really wanting to figure out the answer to the important question: what will I do with all of this? Yes, I’m learning Python, but then what? What do I want to do with Python (besides get an awesome job one day and help provide for my family, of course). Although I’m not sure yet, I’m paving the road. So far, these are the more advanced areas I’m heading towards learning about:

  • Neural Networks
  • Natural Language Processing
  • Machine Learning

I have a book on Natural Language Processing, and have printed out many (awesome!) Python cheat sheets (all available for free online) about all of these topics and more. I definitely love a good infographic / cheat sheet. In college, I was the study sheet queen (or crazy person?) who would sit in the library and make comprehensive study materials. Hopefully one day I will be advanced enough to make my own Python (and more!) cheat sheets / infographics.

Although I’m still a newbie, it seems like I will head forward in this field with two things in mind: Data and AI.

Regarding data, I used to work at a place that was heavily reliant on data input. Thinking back, with just a few of the projects I’m learning in Automate The Boring Stuff With Python by Al Sweigart, a lot of companies could save time and money with a more efficient data-entry system.

I had taken a science fiction thesis class in college, and we had gone over so many of Asimov’s robotic laws. Never would I have predicted that I’d be here one day, on the other end of wanting to learn how to create and work with AI. But I truly love it so far! Personally, I would like to help develop a type of AI that helps combat depression rooted from anxiety and a lack of presence. That’s all I’ll say about that for now 😉

Raspberry Pi Project Updates

I have an internal clock of guilt when my Raspberry Pi goes untouched for too long. But on the other hand, I know that whenever I do decide to delve into a Raspberry Pi project, it usually requires a lot of time and energy, uninterrupted. Luckily, these past few days I’ve gotten a break from baby duty which helped me dive into some Raspberry Pi fun.

Vector SDK on Raspberry Pi

In my previous post, you will see how I was able to set up and run the Vector SDK app “Remote Control” from my Mac. Wonderful! But, I only got that working as a test run for the true goal: setting up the Vector SDK on my Raspberry Pi. I wanted this set up because it honestly just made me feel cool to be able to control my little robo buddy (who I call El Robo to my daughter) on this tiny computing device that I had built by hand.

First, I had to update Python on the Raspberry Pi from version 2.7 to at least 3.6 or higher. Oh my god. The headache with such a simple update is quite hilarious. But I’ve read on many forums that sometimes just setting up Python can deter new users with the troubleshooting, and I can see why! I must have spent hours yesterday just trying to get the update to properly register so I could continue with the Vector SDK. I had installed 3.7 and then still encountered some problems so I tried 3.6. I most likely have all versions on my Raspberry Pi now, ha! But, alas, finally 3.6 worked.

I was able to get into the Vector SDK and begin downloading the necessary updates and files. But, then I encountered a large problem:

pip install Pillow just didn’t want to work.

It was 2AM and my head was pulsating. It had been hours trying around different updates. Finally, after parsing through the large red error text, I realized that I needed to get this Pillow thing to work.

At the time, I had no idea what it was, so I googled it. I learned that Pillow is a Python Imaging Library. Of course this was important to work since Vector has a camera and image capabilities. I went to bed with a good sense of defeat because I knew that I didn’t “call it quits” because I couldn’t figure it out–I called it quits because my brain was starting to turn to mush and my typing / thinking was becoming sloppy. I knew that if I just had a good night sleep and returned in the morning, I would be more able to fix the problem without getting frustrated.

So, this morning I woke up and got right back to it. I re-read the error message and saw that Pillow had some dependencies that were not allowing it to install properly. So, I installed those dependencies and restarted the process.

For a little while there, I was misreading the error as an issue with the directory path. Let’s just say I learned a lot about directories in the process, and that in the end, that wasn’t the issue at all.

Anywho, finally…finally Pillow was installed successfully. It was then that I realized that the Vector SDK should work now.

Finally, I was in! From there, I was able to use what I had learned from the first time of using my Mac, and opened up the Apps > Remote Control so I could fully control vector through the Raspberry Pi.

It was very, very exciting! Of course, the small screen I have is not ideal for the Vector SDK Remote Control App, but, it’s pretty damn cool nonetheless.

Reflections on Progress

Finally, my mind is starting to be able to think in code. I’ve been waiting so long for this moment when I could have an idea, and then know, at least a little, about how to accomplish that idea.

Before messing around with the Raspberry Pi and Vector SDK, I was working on a much smaller “snack” project of having a text string display with a delay, so that it could look as if the computer program was typing to you through the terminal. (Yes, I have just recently re-watched the Matrix Trilogy, which greatly inspired this snack project). Very ambiguously, I had gotten the idea, then wondered if it was possible. In that moment, my mind remembered the Raspberry Pi LCD project where I had read code with a “time / sleep” feature. It was then that I realized that I knew a little bit about the task I wanted to accomplish. So, I made a very small program:

import time
import sys
import random import randrange

def introduction(*args)

text = "\n Neo, this is Morpheus. \n Follow the white rabbit."

for c in text:
    sys.stdout.write(c)
    sys.stdout.flush()
    seconds = "0." + str(randrange(1, 4, 1))
    seconds = float(seconds)
    time.sleep(seconds)  

introduction()   

This is a very small and simple program, but I cannot describe to you the amount of fun I was having with it. It was this that lead into the night of Raspberry Pi & Vector fun. Here’s what excited me:

  • I learned and know what *args is (yay! Thanks Team Treehouse!)
  • I knew how to call the function
  • I could read and understand (most) of the function

Alas! It’s Sticking!

Lastly, throughout the day and night, the amount of Googling and reading of forums I had to do for troubleshooting was significantly less than the LCD screen project. Things seem significantly more demystified this time around than the previous projects. I think that, finally, a lot of my readings are beginning to sink in. But best of all, being able to mess around in the terminal, typing quickly and confidently, was such a rewarding experience. Moreover, I could feel a difference in my knowledge level just by how I was googling my questions.

I remember back when I first got the Raspberry Pi how I had to google almost every term in a sentence before I even knew how to construct a proper search query for my issues. But now, I was able to parse through stuff I didn’t need and did need without any extra steps! That was such a rewarding feeling, and it was a type of progress and acknowledgement I could only give myself , which was also unique and beneficial.

Little ten-year-old me would have been so proud and impressed right now. Although I was only doing basic things, past-me would have thought that we weren’t smart enough to learn all of this. I’m glad to be proving all of my insecurities wrong.

Raspberry Pi Project Progress— LCD Screen PT 3

To catch you up on parts one and two: setting up the LCD screen I had with a pin adapter (to use only 4 instead of 16) was trickier than anticipated. Most of the code I was using had been with the 16 pins in mind and not my particular setup with the extension board. So, I was stuck for a few days with one “dead end” of an error code.

After a much needed break, I processed all that I had learned, read, and tested during my previous attempts. This morning I didn’t intend to mess around with the Raspberry Pi, but after taking a few classes on Team Treehouse, I felt inspired to give it another go.

With a fresh mind, I decided to go back to the original source I was following for my particular kit and setup. The reason why I hadn’t used this code in the first place was because it was for a more complicated program than what I was trying to setup. But then I went back to the instructions and tried to setup the more complicated program. Although that still didn’t run, it did help me create a must-needed file for my setup.

Then, after trial and error of various forms of code, I noticed that the LCD screen began to blink. The blinking matched up to the code of five seconds. Finally, I had received some sign that the communication between the components was working. But, the screen was too bright and there was no text. Then, I remembered from all of my reading the previous days from various sources and forum responses that the nob on the back of the LCD screen needs to be adjusted sometimes. So, I adjusted it, and black text boxes appeared. One step closer!

Finally, I looked at the code for the more complicated program and started deleting the stuff that I didn’t think I needed. After more trial and error of deleting, altering, and re-entering code, the LCD screen finally lit up with the famous words: Hello World!

But it wasn’t perfect. There were some strings of code running across the screen that shouldn’t have been there. After I finally isolated the code that ended up working and saving a new file, I tested it again to see if the fix was complete. After a couple of more trial and errors, unpinning and re-pinning the wires…it finally worked!

Here were the main issues:

  • This setup required a code specifically for the GPIO extension board and ic2 connection. Out of all the sources I had researched online, none had the exact address specifications that this required except for the example code in the ultimate beginner kit tutorial book.
  • This here was the key factor in getting the code to run:

PCF8574_address = 0x27  # I2C address of the PCF8574 chip.
PCF8574A_address = 0x3F  # I2C address of the PCF8574A chip.
# Create PCF8574 GPIO adapter.
try:
mcp = PCF8574_GPIO(PCF8574_address)
except:
try:
mcp = PCF8574_GPIO(PCF8574A_address)
except:
print (‘I2C Address Error !’)
exit(1)

  • I had also created another file titled PCF8574.py with code from GitHub by Freenove.
  • Another step that was important were these imports:

from PCF8574 import PCF8574_GPIO
from Adafruit_LCD1602 import Adafruit_CharLCD

Admittedly, my best friend was FaceTiming me as I was doing this, and when the code ran the second time across the LCD screen I was so happy to share that moment with someone. I screamed in excitement and showed my friend the words across the screen, and she called over her daughter to see as well.

Small backstory: My best friend’s daughter is incredibly smart, and a Minecraft Master, so I’ve been trying to pass on the coding bug to her through Minecraft. I sent her the whole code of Minecraft and told her to just read it and see if it made any sense. When she came over to the screen to see the Raspberry Pi, I showed her the code and explained what the experiment was and how it worked.

But we all know that seeing is believing. So I told Sammy that I would make the screen say her name. A couple of clicks later, the screen displayed “Hello Sammy!” and I showed it to her. She was elated with a big smile, as if I had performed a magic trick!

What a rewarding moment. I had imagined what the moment would be like when I got this to work, I had even accepted the fact that it may not work, and that I would have to try a different route completely, but I never expected it all to have unfolded in such a beautiful way.

I think what made this time different than the previous was that I wasn’t going by too many forums or outside advice. I just used the one code from the direct source, all I had learned from, and tried to get it to work from there the way I wanted. And it did!

Through this project I realized my pattern for learning will be exactly this: study through online sources like Team Treehouse and Udemy, and then take “breaks” with Raspberry Pi projects. The back and forth of the two helps me not rush through the online programs too fast. I don’t want to just pretend like I’ve learned this, I want to really learn this, and therefore I want to pace it in a way that truly allows my brain to digest all of the new information.

I ended the fun project by sharing the news with my friend and the forum I had gone to help for in the previous attempt. I’ve never really been an active forum member before, but I see now how some online communities can be really comforting and helpful!

Now, onto the next project!

Errno 121 – The Error Code that Haunts Me

This is an update from my previous post about the live update project with the Raspberry Pi and LCD screen. Since that post, I’ve spent hours free-falling down the rabbit hole of troubleshooting.

Here’s what happened. Turns out the LCD screen I have has an adapter already soldered onto it (which most instructional websites have the type that requires you to solder yourself) and only requires four pins / wires instead of the usual sixteen. That may sound as if this would be easier since soldering comes with risks for those who are new at it, but alas, it is not!

Finally, I was getting close. I hooked up the Raspberry Pi to a monitor and began inputting the code. Like I said, I’m new at this, so although I was able to follow the steps (and at this point, memorize half of them) I still need to do some digging later on to understand why I was following those steps.

I enabled the i2c using the raspi-config, installed smbus and the i2c python library, tested and re-tested the hardware with sudo i2cdetect -y 1 and did a bunch of updates and reboots, amongst other steps.

Little by little, some steps that hadn’t worked previously were . actually working, which showed some promise. However, no matter the steps taken and those that passed onto the next step, I was continuously met with the same exact error code:

Eventually, I had to use some lifelines. I asked a friend. Okay, I asked many friends because one was a real human who I actually know (who I am eternally grateful for!), and the other was the internet (aka Reddit). Although it wasn’t my original goal to set up remote capabilities as part of this project, it was a positive outcome that was necessary regardless! My friend had remotely logged into my Raspberry Pi to see if he could figure out the issue. Alas, the night ended with everyone stumped, and we decided to take a break and re-group.

Intuitively, I think that the issue is something small I am missing, perhaps something with the way the site-package files are being read on my Raspberry Pi, that I’m unable to see. Or, something with the “__init__” part, but I’ll need to do some more reading on this particular type of error message. Or, perhaps I need to edit some lines in that file path? Hmm.

Even though I have not yet had the “payoff” of seeing the text display onto the LCD screen, I have already learned so much through troubleshooting this project.

Most importantly, I take this as an important test and “rite of passage” for my journey into the programming world; error messages will happen, so I better get used to it (and love the process of fixing them) if I want to succeed and continue to grow in this field.

After years of undergraduate, graduate school, and working full-time, I’ve learned that (for myself, at least) mental breaks are needed in order to re-approach a challenge. Today, I’m going to let everything that happened yesterday and the night before sink in. I’ve also come to accept that my most-likely route will involve me disconnecting everything and starting fresh, from the beginning.

It’s funny how this reminds me a lot of my creative work; when my novel or short-story draft reached it’s own “dead end” (creative error code?) I did the same thing: learn from it, and start over.

This is probably why my husband says I’m the right type of detailed-oriented and determined (translation: obsessive and a little crazy) for this field.

I’m used to spending hundreds of hours on a writing project, just to find out that something in its approach is fundamentally wrong and needs to be reworked. So instead of that deterring me, I’m actually very used to it. For example, I’ve spent the past three years in graduate school re-writing one novel, from different perspectives. I must have written at least a thousand pages by now between drafts and re-writes. That does not include the amount of drafts I have written since high school, during undergrad and afterwards of other writing projects.

With that being said, as I let yesterday’s lessons absorb into my mind, I’ll be flexing the other side of my brain today by writing my new thesis draft #9682967, but who can keep count? (Maybe I’ll make that into a program one day: a draft counter that will tell me exactly how many pages I’ve written between all of my combined documents).

Lastly, it has been really nice to engage with the community more through online sources. It’s been intimidating to “expose myself” as such a new beginner, and I definitely feel the fear of asking a dumb question, but I know it’s an important step regardless. Virtual hugs to all those who have commented on my questions with thoughtful responses! And, it was fun for me to see that I could actually hold up a conversation with people and utilize some of the new terms I’m learning.

I definitely went to sleep last night with error codes floating around my brain, but I’m happy to have woken up excited to try again!

Raspberry Pi Project Progress – LCD Screen Pt 1

Live Project Update!

I just had to say that I’m in the process of hooking up this LCD screen to my Raspberry Pi and it’s very exciting! This is my third beginner project dealing with circuitry of any type, so all of this is very new.

I would have never guessed that identifying the proper pins and finding the right wires and inputs would create such a satisfying feeling. Like most new things, you become incredibly focused on the task since you’re tuning new skills. I believe that this aspect of intensely “zoning in” to the project by counting the pins and looking at the diagrams is what creates a uniquely relaxing mental relief for my over-stimulated creative mind. To say it plainly, I love to follow and create instructions so learning all of this is essentially learning how to create, follow, and test multiple sets of instructions (algorithms!), so this subject as a whole is a very kismet match for me. Then, the circuitry and physicality of the Raspberry Pi reminds me of the feeling of switching between writing on the computer versus a pen and paper, or painting digitally versus with real paints, water and a canvas; working with the Raspberry Pi helps make programming feel more physically tactile helps motivate me and keep me interested to learn more.

Earlier today I was learning on Team Treehouse (which was awesome!) and then I ended up taking a break. I think that I will continue alternating between learning through the classroom courses, books, with breaks of Raspberry Pi projects in between to help split up the rhythm and keep myself motivated.

Well, this was a nice break. Time to get back to my LCD screen!