Monday, February 08, 2021

Quick Note: IDLE Double Run Fix

 Hi All, 

This is just something that has bothered me about IDLE through Anaconda on my Mac where if you hit F5 to run your module, it runs twice.  So I figured out how to "fix" it.  

Go to your python installation and find the idlelib folder (mine is anaconda3/envs/python36/lib/python3.6/idlelib).  In this folder you'll find the files that run IDLE, the basic bare-bones IDE for python.  Through poking around I found it seems to run twice because it runs once when you hit F5 and once because when you hit F5 it runs the Run Module menu item.  So in order to fix it we need to assign the menu item somewhere else, I cleverly named it run-module2.  Open mainmenu.py and edit run-module to say run-module2 (as shown).  


Now if you were to run idle like this F5 would work, but the menu way wouldn't, so we should fix that while we are here.  Open editor.py next and copy and paste the run-module line and rename the second one run-module2 (as shown). 


Once I did that, both the menu and F5 ran once, properly, when I selected them.  Hooray! 

Now I can go back to work. 


Friday, May 08, 2020

Fix-it Friday: Blank Laptop Screen

As I was preparing last week's post I heard a crash behind me and turned around to see a surprised 10 year old no longer with a laptop on her desk.  So we tried turning it off and on again, no dice.  I have a spare monitor for my Raspberry Pi station so we plugged that in to see if it was the whole system or just the monitor.  It worked! And with the external monitor she could use the whole computer normally so that is a good sign.  I tried toggling the monitor settings with the function keys and the windows menu, no good.  The good news is, it is just the monitor.
There might be hope for the patient yet, the next question is if the monitor is broken or simply a wire came loose.  Let's test the camera, that doesn't work either.  That makes me hopeful it is just a loose wire somewhere.  To the tiny screw driver set! I took off the bottom first, hoping the problem was in there, but everything looks in order.  
The monitor cable is in the bottom left of the image by my finger.  Looks and feels secure.  Ok next is to take apart the monitor.  Mine had these little rubber nubs that were hiding the 1,000 tiny screws that hold the monitor in place so I first removed them and then unscrewed everything.  Then I gently pried the plastic cover off like I was taking a tire off of a bike to get to the tube.  Two screw drivers gently tugging until it popped the plastic nobs without (hopefully) breaking them.  Got it! 
As you can see, I had a little oopsy in the top left corner, hopefully it won't be too obvious once it is up and running again.  Nothing obviously wrong here, but lets follow that wire in the bottom left and see where it goes.  A ha!!
Doesn't it look like there should be a wire plugged in there?  Well there is, this is a terrible picture, but it is a loose wire.  So I plugged it back in and put the monitor back.  I gently placed all of the covers back and booted it up.  Bingo! 
What a generic, boring background my daughter has.  I mean it is a beautiful image, but I think I can do better.  I have to test the camera anyway so... 

That's better, now hopefully that will be a daily reminder to be more careful with the only laptop we have.  Just in case you want it to be your background too:
I wonder what is in store for next week. 


Friday, May 01, 2020

Fix-it Friday: Clogged Vacuum Cleaner

The patient presents with a red indicator, indicating a clog.  So first we do what the instructions say and clean out the filter and let dry completely.  Since I thought this would be it, I didn't take a picture.  This is usually the problem, but this time with the completely clean and dry filter assembly, still red.  So lets take it apart.  Most likely place for a clog is in the bottom:
 If you look at the image carefully there is a pro-tip from the manufacturer: "Use a screwdriver to take out the screws."  Thanks Hoover, I couldn't have figured that out on my own.  After unscrewing the screws with a screwdriver (who would have thunk?) the problem becomes clear:
Look at that big ugly piece of fluff, let's take that out.  Hmm, there seems to be more stuck in.  Ok let's take off the back hose and cram something in there to get it out.
 Now we are cooking with gas.  After I pushed as much as I could out with the stick, I pushed an old ethernet cable through so that the pokey plug in bit could grab any stragglers that were left behind.
Yikes that is a lot of fluff (and one lego, score!).  Let's clean off the string/hair/thread before we put it back.  Ah, that's better:
Now to reassemble and test and it purrs like a kitten.
I wonder what we'll do next week.  

Friday, April 24, 2020

Break to Make: CO2 Detector Take 2

As we saw last time, I made something fun, but not very useful.  So let's make something useful today.
The Problem:
My daughter is not in school right now, as you may have experienced yourself.  At her current age, she isn't supposed to have very much screen time, but almost all of her work is online now so we decided to set a limit of 30 minutes of screen time and then a break.  With me working and my spouse taking care of our other little one, who is watching the clock?  The answer turned out to be no one.  I could set a timer on my phone, but that wouldn't be my daughter taking responsibility for it so what can we do?
The Solution:
If only we had a buzzer that I could make a timer out of.  Didn't we have one by the albino the hidden alarm?  We did, what I wouldn't give for a holocaust cloak a button switch and an LED.  That's right, observant readers will remember they were both on the CO2 detector that we didn't use.
So after a quick desoldering, we have them.  But that little blue button is not very attractive, I'd rather it have a topper like these nice ones from Adafruit.  Let's check Thingiverse first, this one looks perfect, but it is for the wrong size button.  Let's print it anyway and scale it to see, nope the middle is all mushy.

Now, on to OpenSCAD! My calipers say the small blue button is 2mmx2mm and the Adafruit site lists the size as 12mm, so a big cylinder (r=6mm) for the outside minus a cube (2mmx2mmx2mm) for the inside.  Done and done.
Doh! 2mmx2mm is exactly what the button is and the actual printed size is too small.  Let's try 3mmx3mm.  Bingo (file on Thingiverse).  
Now to put it all together, a button, an LED, a buzzer and an Arduino, now we can make a timer.
So I was thinking, push the button and set a 30 minute timer.
if (buttonState==HIGH) {
    digitalWrite(ledPin,HIGH);
    delay(1000*60*30);//1000=1 sec, 60 sec in a minute, 30 minutes total
    playMelody();
    digitalWrite(ledPin,LOW);
}
And to test! 30 seconds? Let's check the math, 1000 ms in a second * 60 seconds in a minute * 30 minutes, right?  Yes.  Hmm a cryptic warning from Arduino: "More knowledgeable programmers usually avoid the use of delay() for timing of events longer than 10’s of milliseconds."
Interesting, it seems like there is an overflow problem.  So lets delay for 1000 (1 second) and count up to 1800.  And it works (code)!  So next we cram it back into the CO2 detector shell.  First, I cut all of the unnecessary plastic bits out, then I got my tiniest breadboard.

And did you notice? There are three AA batteries, 1.5*3 is 4.5V which is within the power requirements for Arduino.  So a quick solder for that and solder the wires to the buzzer to save some space and Voila!

I had to cram some thick paper in there to make the button stick out and I accidentally broke one of the clips so I had to hot glue it, but other than that we are done.  The wires are rescued from some old ethernet cable I had laying around.    

And now, we come in at 29 minutes and 59.5 seconds.  

Well this time, it is both fun and useful.  Hooray!

Friday, April 17, 2020

Break to Make: CO2 Detector Take 1

Hello Friends, today we will make something new out of an expired CO2 detector.  First we take out the batteries.
Ok, now the screws, nope, no screws ok, there are little plastic tabs holding it in place.  If you can wiggle them gently and cram a little screwdriver in there we can take the bottom off and it will easier to put back together.  I also flipped the circuit board over to get a better look at the components.  Voila:

That looks like one honkin' big buzzer, lets see if it works like a regular buzzer.  It is Arduino time. First load toneMelody onto your Arduino (File -> Examples -> 02. Digital -> toneMelody) which plays the catchy jingle, "Shave and a haircut, two bits." Apologies to those who are more familiar with the inappropriate version which I will not repeat here (for the curious, the second to last word is madre and a description can be found on the Wikipedia page for "Shave and a Haircut").  Anyway, where was I, ah yes, if you have a buzzer or speaker laying around you can test to see what it sounds like by connecting pin 8 (usually) to the positive and ground to the negative.  The Arduino Tutorial page has a good description.  Next is to get two longish jumper wires, one in pin 8 and the other to ground.  We are going to have to flip the board back over to get at the pins for the buzzer:

You might have to flip it back and forth a few times before you find the right ones, they are larger than most of the pins in the area and mine had three (one is being touched by the blue wire in the above image and another is by my finger).  Pick two and apply the wires, did it work? Try flipping the wires, now? Try different pins, and? There are only six combinations with three pins (3 choose 2 = 6) to it shouldn't take too long.  Also, you might want to adapt the toneMelody code to play on loop so you don't have to keep hitting reset on the Arduino and hold the wires on the pins at the same time, but it isn't absolutely necessary.  Success!


Ok, so now we heat up the soldering iron.  I can't figure out how to hold my phone and the soldering iron and the CO2 detector all at the same time without burning myself so no action shots, but basically I took a smallish screwdriver and gently wedge it between the buzzer and the circuit board then on the bottom I put the soldering iron on the leg closest to the screwdriver until it is melty and moves.  Then I move the screwdriver to a different spot and repeat until all of the pins are out.  Got it:
Let's just double check that we didn't fry it.  Also, I switched to M-to-F jumper wires now that it is off the circuit board.


Score! Now we are ready to make something with it.  I happen to have a photoresistor in my Arduino kit and you probably do too so I thought it might be fun to make an alarm.  The photoresistor tutorial is here.  We can add that to the breadboard and set up a simple trigger.  To minimize fiddling I set the baseline value to the ambient lighting on reset and then the trigger will be when it gets at least 90% darker.  If you don't want to figure it out yourself, the code is here. Testing:


Not too shabby.  And now to cram it all back into the base and test. 



Well that was fun and a little silly, but not very useful...  

New Chapter

Hello out there my faithful and few readers, I am now at Sacramento City College.  Because of the social distancing, I'll put some Maker Friday posts as part of Sac City's Makerspace.  Which I am the co-co-coordinator of.  More to come soon, including Fix-it Friday, Break to Make, and more!

I have been working on these for a few weeks now, yet you see nothing here.  While you wait patiently, check out these Arduino projects I made for our "Pathways to Paychecks" events for High School students: djArduino, moodLight, and the ever popular arduinoTwitterBot

Friday, October 24, 2014

Transitioning to ACOE

Hello out there in Math Blog land. In my new role as Mathematics Specialist at the Alameda County Office of Education's (ACOE) Division of Core Learning. I will be writing blogs for them at: http://acoecore.org/welcome/blog/ No longer working, but here is a pdf of some archived posts.  (Thanks to web.archive.org)

Friday, June 13, 2014

Robotic Drawing Machine (formerly known as 2D printer)

I have been busy working on various Arduino projects for this summer's Governor's Institute of Vermont. One of the culminating projects was the 3D printed, 2D printer that Elaine Blomeyer and I designed. It works!
You can see it in action here.

Saturday, March 15, 2014

3D Graphing Anyone?

Well the most recent updates about the GeoMapApp is that it is working well. It is easy to use, I fixed the vertical exaggeration problem and the program will be released after David Thesenga and I present at NSTA (until then the code is available for your entertainment). Also, I rewrote the program so you could make 3D graphs 3D printable. As a math teacher, this project suddenly got a whole lot more exciting. Not only are 3D graphs hard to teach in upper maths, but think of the possibilities for Algebra. What if each student could print out a different slope and compare them to the others, how different would their understanding of slope be if they could touch it? It is available here. Check it out:

Monday, February 03, 2014

Geomapapp -> stl!

After several weeks of research, programming, tinkering and a little frustration, I was finally able to download a picture of a specific region from Geomapapp, convert it to an stl file, and print it on the 3-D printer. I am pretty sure it is Mt Rainier. Here it is on thingiverse. Next, I will develop a GUI so that it is easy to use for middle school students.

Monday, January 06, 2014

IET Flyer

Introduction to Engineering Thinking: A Project Based Massive Online Open Class (PBL MOOC) - Starting 1/13/14

Teacher’s view: This class was designed to answer a fundamental problem with most MOOCs, they are lecture brought online. Despite what we know from classroom experience and research that most students learn better when they can interact with the content and other students (from Piaget, Vygotsky, et al), this component was missing from many online classes. Pair that with the make to learn ideas (from Dewey, Papert, et al), where students are constructing a physical object while constructing their own understanding, and this class is born. It is designed to be free to take and free to make. All projects can be made with items most people have in their houses (or classrooms) and require no previous making experience. The class has three a la carte options, just engineering (build the projects and reflect on your work), just math (learn about the math behind the projects), just physics (learn about the physics behind the projects). Ideally, students will choose all three and will be rewarded with a STEM Master badge (mozilla open badge). Unlike many of the MOOCs out there, this class is written at the High School level so it will be accessible for a larger number of students from High School up. I am also hoping teachers interested in incorporating engineering into their classrooms, but unsure where to start, will look to this class for ideas. Enrolling now: mathtown - coursesites

Student’s view: This eight week course has six projects, each week there will be a project assigned. You will have two weeks to complete each project and the associated assignments. Each project will have 3 parts, the engineering part, the math part, and the physics part. The engineering part is where you actually build the project and document it. In the math and physics parts, you are either taking data or learning about some aspect of the project that relates to math and physics. These parts are optional if you only want the engineering badge. If you successfully complete the math part, you will receive a math badge and the same goes for physics. If you complete all three badges you get a STEM (Science Technology Engineering and Math) meta-badge that will show you completed the course with distinction. This class is designed for High School students who do not have access to engineering at their schools, but is open to everyone. The idea is that you can get a taste of thinking like an engineer and then use that type of thinking to pursue your goals on your own. So many MOOCs (Massive Online Open Classes) are just lectures put on the internet, this class aims to break that tradition by providing a PBL MOOC (Project Based Learning) model that will hopefully be the first of many. It is a free class and all of the projects will be free or nearly free to create. Engineering design is a way of thinking that will be helpful to you in any problem solving situation. Successful completion of this class will enable you to think like an engineer. Being able to think like an engineer is a skill that will help you in any science or math class or career. What makes engineering thinking important and useful is its tinkering approach to problem solving. The same way of thinking that helps an engineer figure out where to put the speaker on a cell phone, can be used to figure out why the toilet isn't working, or how to solve a math problem. Students successful in this class will have the tools to become a maker, an important step on the road to engineering. Enrolling now: mathtown - coursesites