When some teachers asked me if we could build a temperature sensor
that didn't require walking up and taking a physical reading, without
hesitation I said yes. What followed was a deep exploration into the
Arudino environment and an introduction to Python coding.
The
project has been very rewarding. While not totally complete, we did
answer the question of whether we could build a system that could
remotely monitor the temperature and communicate that information in
graphic form to another computer. Now the winter has left us, we'll
have some time to move our beta to a real embedded model.
When
I initially began the project, I worked independently trying to learn
as much as I could about the hardware, what I needed to order and how to
set it up. After some individual learning time, I started working
with some students from our Computer Systems Technology class. They
helped with soldering parts and setting up our communication network
with our Arduino compatible radios. We also studied some of the Arduino
code libraries, testing a variety of sketches using our new Xbee
radios. Probably the most fun we had was building test models of
projects that were not even related to our project. As long as the
students were excited, I didn't mind the need moving slowly on this
project. Learning can be fun, and experimenting is probably the best
form of that.
Currently the project is in beta
form. We have to still figure out how to use our digital sensor to pass
data. We had no problem with the analog sensors. We also have to
build a waterproof shell and configure the radios to hibernate so as not
to burn out the batteries. I've spent countless hours working on
various configurations, temp sensors and code combinations. I feel like
I am a lot more confident while working with the Arduino IDE and
writing basic code. I really enjoyed learning some Python basics and I
only hope I can get a few more students interested in the project and
other projects by showcasing this one. I plan to introduce this beta
project with the new CST class next fall. We'll then form a group that
will tackle this project including the design of the housing and
computer configuration (remote IP address and website) that will be
capturing the data.
I've included this Link to my Google Site - Create with Code. There you may explore the entire project, review the code and set up. Share any materials as you see fit.
This spring I enrolled in a web design course with UVM. Weekly we have been creating with Code! To date, I've created four different web sites using HTML and CSS. In addition, we have been writing a lot of PHP to create the HTML code on each page, or for validating forms, debugging and automating pages.
For example, instead of updating a footer element on each page of a ten page site - just create a footer.php page and write your footer. Then, call the footer on each web page using a PHP include statement. Very cool way to do mass updates and changes. I learned that the same process can be used to create a header.php, nav.php and top.php pages. This process ensures that each page is structured the same way.
CSS stands for Cascading Style Sheets. CSS is what makes webpages look great - color, fonts, design and layout. A fun website to see how CSS works is to explore csszengarden.com. On this site, all of the content is the same, but the CSS gives each example a unique look. CSS is very powerful and a creative way to style the web and improve the user experience.
This past week, we've been using PHP to validate our forms, sanitize and check our data for errors and return a confirmation statement or error - with an array to list those errors.
Check out the error functionality I created using PHP code: https://wbohmann.w3.uvm.edu/cs008/assignment3.1/form.php
The PHP coding for form validation took over 10 hours to write and included more than 300 lines of code. This has been a challenging class with UVM - mostly due to the PHP. However, I've been learning a lot about creating more functional websites. For my final project, I plan to create a website for my summer food truck - StreetGreens.
I've been putting off my xbee project for awhile. When I was working with it early on, I failed to document many of my resources, my failures and successes. Recently I attended a session at the SXSWedu conference on Open Portfolios. Essentially by not documenting my process, I failed to complete a portfolio of my learning. So, for Week 10 of Create with Code, I decided to go back and spend some time re-curating my resources and finally trying to get my damn Xbees working with a real sensor.
Here's a list of great resources for Xbees and Arduinos:
The first is from TunnelsUp. There are 5 videos in this series that go over some excellent material on how to set up the Xbees with XCTU software, learn about Coordinator and Routers and setting up a network. I also learned how to jump my chip on the arduino and make a serial connection hack - which saves about $25 on a device that does the same thing.
The next best resource from the same author is the Xbee Cheat Sheet he made to better understand all of the pin locations, settings and basics. I use this sheet often.
Both AdaFruit and Arduino Forums have a fair amount of information on the Xbees and even better, information on sensors, especially Adafruit. The Arduino forum has a couple of members that are pretty curt with responses. One member responds to most queries in the forum, but I've noticed a pattern around how poorly he treats people with questions.
YouTube has been really valuable. There are a lot of people building interesting things with the Arduino. I found someone who is doing something similar to what I want to do, except he is using a temperature and humidity sensor to measure his chicken coop.
Well, on to my project. Step one was to get the two Xbees to communicate. Check! Using the XCTU software on two computers, a student in CST, an instructor of the same course and me set up a xbee network and communicated on the same channel through a terminal window. I recreated this same "Chat" this past weekend just to make sure both my Xbees were working correctly.
Step two: hook up a temp sensor (I just bought a fresh TMP36) from Amazon as well as a DHT11 sensor. Both worked well, running the Sketch #7 in the SIK Sparkfun Guidebook for the TMP36 and the AdaFruit Sketch for the DHT11.
Step three: Draft up my sketch (see my video below) and plan my network. So far, it made sense on paper. I built the sensor, configured the xbees and used some sample code from TunnelsUp (found in Video 4 of his series).
Step four: Frustration. After an hour, I finally got my xbees to communicate. I think either the router went to sleep, or the wrong port was called for communication.
This video shows my progress so far. I've been able to set up a connection and reliably communicate from the router back to the coordinator. However, I cannot seem to get the voltage right, as it does not appear that the Code is sending the right information packet for the sensor to grab. I spent about six hours debugging, re-coding and troubleshooting. I am totally at a loss on what might be happening. I am going to meet with the CST department for some new direction. Ultimately I want to hook a digital sensor (ds18b) to send temp information. If I can't get the analog to work, I don't know how I am going to attack my compost temperature project.
Here is the code I am using to call the sensor.
float temp; void setup() {
Serial.begin(9600); };
void loop() { if (Serial.available() >= 21) { if (Serial.read() == 0x7E) { for (int i = 1; i < 19; i++) { byte discardByte = Serial.read(); } int analogMSB = Serial.read(); int analogLSB = Serial.read(); int analogReading = analogLSB + (analogMSB * 256); temp = analogReading / 1023 * 1.23; temp = temp - .5; temp = temp / .01; temp = temp * 9/5 + 32; Serial.print(temp); Serial.println("degrees F"); } } }
Wink is an arduino fan delight - I've enjoyed playing with the code and the lessons from PlumGeek are pretty good too. I posted the following on the Robot Rodeo blog:
Meet Ferris. Ferris is actually the Wink robot from PlumGeek Software.
The Wink robot has been designed to introduce programming to people who
are interested as an entry point to learn how to write code and for
experienced coders alike. Using the Arduino IDE open source platform,
code can be written to activate a host of exciting features that are
built into the robot. These features include blinking RGB lights,
actuators for movement, proximity sensors for obstacle detection, light
sensors for following light and line detection and for some Winks, a IR
remote to control those behaviors.
I named my robot Ferris, because I had some challenges getting him to
school each day. The challenge of setting up reminded me that sometimes
Ferris just needed a day off. Now that I've broken him in, he's been
pretty dependable and can do some exciting things.
The first hurdle has been introducing the Arduino programming to High
School students who've never written code in the Arduino environment. PlumGeek
has helped bridge the gap by providing a series of usable lesson plans
and pre-loaded behaviors available for download on their website.
Fortunately, I've been working with a couple of classes at the Center
for Technology in Essex. The Computer Systems technology class and
PreTech classes have been able to play with Ferris. We've started doing
basic coding, like learning how the lights operate, adjusting Ferris
eyes to blink, change colors and emit different light levels. I'm
working with a student at the moment on obstacle detection, which Ferris
is really good at. The light detection sensor is very good, as Ferris
seems to have a strong will to find a nice sunny space to relax in
(don't we all). Here's a little of Ferris in action (my dog does not
care for Ferris - you might hear her whine).
Recently I changed my modem as Comcast changed their support for certain generation devices. Ever since the changeover, my internet has been pretty slow. Turns out, Comcast has been having trouble in my area since around the time I activated my new modem. However, today - no internet. My teenage daughters were in rare form. All of a sudden, they had homework that required the internet.
So, to make the time pass with my younger one, I broke out the Arduino. She was reluctant at first, but then jumped right in. We made multiple lights blink in different patterns, added alligator clips and more lights to the circuit to make lights on a stick (with glowing cotton balls) and we hooked up a TMP 36 temp sensor and measured who's breath was hotter. We also rigged up a photoresistor and and made an attempt at a battery operated night light. It was pretty fun and finally my daughter got a better idea what was in the piles of Arduino gear on the family dining room table.
Arduino Gear on dining room table
Maybe I didn't create too many complicated sensors, but I did enjoy the break and a chance to talk about the code with my daughter. She got a kick out of changing the code and adding new code for new lights. Sometimes there is good reinforcement in the basics.
The first day back from winter break turned out to be a snowday for many of our sending schools. For those few souls in PreTech that made it to school that day, we had a fun day planned with robots and programming. Many robots were in play that day, we had the Ozobot, an Sphero, the Finch as well as my robot - the Wink.
After a troubling installation of the software and nearly having my paired student lose interest, I finally got the Arduino software mapped to the correct directories. Teaching myself has mostly been a trial of mistakes and practice, and I knew that working with this student was not going to be so easy, as I had to explain what Void Setup, Void Loop and other programming features of working with the Arduino based platform. We decided to run a program on the WINK just to manage the eyes. Our code looked like this:
void loop(){
leftCyan(100); //make left eye cyan color delay(20); //stay on for a short time eyesOff(); //turn eyes off delay(100); //delay between blinks leftCyan(100); //begin second blink delay(20); //stay on for a short time eyesOff(); //turn eyes off again
delay(2000); //time before 2nd eye blinks
rightCyan(100); //make right eye cyan color delay(20); //stay on for a short time eyesOff(); //turn eyes off delay(100); //delay between blinks rightCyan(100); //begin second blink delay(20); //stay on for a short time eyesOff(); //turn eyes off again
delay(2000); //time before repeating }
Once the student learned what the delays were and what colors he could call out, he started to change the code, copy the code and add to the code to run the WINK through a series of color changes and brightness stages. Adding brightness, the code looked like this:
void loop(){
eyesBlue(25); //set both eyes to blue, at brightness 20 delay(200); //wait a short time eyesBlue(75); //set both eyes to blue, at brightness 75 delay(200); //wait a short time eyesBlue(125); //set both eyes to blue, at brightness 125 delay(200); //wait a short time eyesBlue(175); //set both eyes to blue, at brightness 175 delay(200); //wait a short time eyesBlue(225); //set both eyes to blue, at brightness 225 delay(200); //wait a short time
eyesOff(); //turn eyes off delay(1000); //wait 1 second then repeat }
Again, he repeated the code, changed the colors, brightness levels and so on. Eventually we called out RGB color by using his favorite colors from Color Scheme Designer. While just remixing, the student who was initially not too excited, responded and said "Cool". Which I'll confirm as a small success.
I'm at an interesting place with coding at the moment. I've been challenged by an Arduino project that I mentioned in my last post - which was to build a wireless sensor that communicates via Xbee zigbee network. In addition, I have the Wink robot from PlumGeek (thanks to Learning with Lucie )that is coded in the Arduino environment using the same coding language as the Arduino - Python. On top of those two projects, I enrolled in a Web Design course this year because it's been awhile since I've done some web design work. We've been doing a lot of PHP which was not something I learned years ago. Also, HTML5 is now nearly standard, so most of the structure of websites now uses abridged elements and PHP for easy updating and universal design. I've been challenged with writing PHP arrays. However, I've seen some good crossover from the for and foreach statements as well as the conditional statements in Python. I'm feeling "all in" at the moment. Many projects, lots of coding, lots of reflection.
My desk - littered with fun toys
Fortunately, there are so many great web resources for helping out folks like me who like to stumble around in the dark and figure things out:
PlumGeek and the PlumGeek forums has been really helpful. I joined the forum and asked for some support and the community quickly responded.
On an Arduino forum, I found an interesting project similar to mine and emailed the poster. Within a day a retired man from Florida who authored the post shared some resources and some advice for how to proceed with my Xbee project.
Lastly, I've been using the web developer toolbar, firebug and W3Schools for learning all kinds of information for web design, including tutorials on PHP.
For the next two weeks, I am really looking forward to working with some of the materials on my desk and the Arduino IDE platform. Recently I purchased:
I am hoping to build in the next week a wireless sensor network to take the internal temperature of a 30 yard mound of woodchips that is being used to heat our greenhouse. This project, and the parts list above is over a month in process, as I was waiting to get a lot of the materials. Now I am ready to dig into some coding - Python mostly, to execute the Xbee wireless network. I'll update here.
For the first project, I am going to set up a simple chat between two communicators using a terminal window and configuring two Xbee's with the same channel. One communicator will communicate with another communicator. A good tool for doing this is the XCTU software by Digi.
This week as part of my Create with Code course, I spent some time working on my iPad. I mostly use my ipad for creating and editing movies as an assessment tool with my students. We video procedural steps for demonstrating all kinds of skills, like steps to properly sear a salmon in the Professional Foods program or showcasing proper safety when handling shop tools in Building Technology.
This week I had the chance to explore some of the creation tools for creating your own game, puzzles, quests and challenges - similar to the different types of games you might find in the App store. While creating with my personal device, I was reminded of a quote that I pulled from Seymore Papert's book, Mindstorms. His quote was the following:
"Increasingly, the computers of
the very near future will be the private property of individuals, and
this will gradually return to the individual the power to determine
patterns of education. Education will become more of a private act, and
people with good ideas, different ideas, exciting ideas will no longer
be faced with a dilemma where they either have to sell their ideas to a
conservative bureaucracy or shelve them. They will be able to offer them
in an open marketplace directly to consumers. There will be new
opportunities for imagination and originality. There might be a
renaissance of thinking about education. "
Using Hopscotch, I created a game much like the old arcade classic - Frogger. You can try my game out yourself (as basic as it is), I called it Turtle Crossing, take a look. Hopscotch forced me to consider my games goals. Then, by breaking down the tasks for the individual assets, I created loops for the cars using block programming. In addition, I had to consider conditional statements for my main character to consider what happens if my game piece collided with a car, or what would happen if the character completed the goal. Additional buttons for controls had to be configured as well. It was not as difficult as I thought. I first had to start thinking in simplest terms, and code the scenarios.
Video of my solution
I also had the chance to play some games as well. The video above is from one of the levels in CargoBot. I found these puzzles very challenging. Using controls and then programming those controls, I programmed the bot to move the boxes. With limited program space, the game player has to create loops and use visual blocks to create conditional statements. I had trouble wrapping my head around this. I could talk out the movements, but really struggled with configuring the correct movements with the limited programming space I was afforded. If I could spend time with others working on solutions together, I think my learning curve would improve. This was a game that benefits from more than one competent mind! As Papert states in the quote above - "there will be new opportunities for imagination and originality" - all on my iPad.
I had a lot of fun and spent way too much time coming up with a skiing game using Scratch. The game uses different sprites as backgrounds. I've set the background sprites to move so it appears that my skier sprite is actually moving downhill. This took me a long time, you can go into the code and have a look. One of the challenges is the sprites were moving at different speeds. Once I figured some multiplication and division strategies to have each sprite background roll on and off the screen at equal rates, all was good. I used a broadcast feature so that when you collect a hat - the crowd shares a message. Points are scored for hats and deducted for time in the trees. Have a go at it.
Now for the Makey Makey, I thought a good authentic controller would be one you could use with your feet. I used two wet paper towels and fixed alligator clips to them, one for each foot. You control the skier with your feet, right and left. I like the hands free part of the game - makes the play experience a little more fun. Link to Video
What I took away from this project was coming up with strategies to accomplish what my goals were. I listed on paper the game elements I wanted. I then broke those elements down into workable units to set up the code. By working on a section at a time, I could make a large project seem smaller. I also tried different iterations of the game and did a bit of testing. Sure, I'd like to change many of the ways the game plays, but I got some good practice with conditional statements and loops to achieve a usable first version.
Sunday, January 24, 2016
CS First Game Design Units
I finally finished my first 8 activities with Google's CS First web series using Scratch. I never knew so many tools are available using Scratch. This program is probably the best set of training activities to learn the Scratch program and to learn the fundamentals of programming in general. I only wish you could see the actual code after completing the blocks to get a better idea of what the actual code looks like. For students in middle and high school, this would be a great feature.
Thursday, January 21, 2016
Working Through CS-First
Google's CS-First program is an excellent introduction into Scratch and the basics of computer programming. Exploring conditional statements, operators and events all in the name of design creates limitless development opportunities and coding challenges. I've taken my time exploring the Game Design section of CS-First, dedicating an hour or so to each unit. So far I've completed the first three units. While I have done some Scratch work before, I have been learning a lot more through this instructional platform. The add-ons section is really informative and I found myself looking at each one. I found it helpful to tell myself what I want the sprite to to or how the game to react and then I find the tools to block program that. Very intuitive once you think about the thinking! I'd like to make a game, I just don't have an idea of what it might be yet. Looking forward to working through the rest of the units.