All posts by gbushta

Swearing ATTiny85

Following this page, http://hackaday.com/2015/10/21/teach-an-attiny-85-to-swear/ .  I put this together and stuffed it all into a mint tin.  I didn’t know how to post pictures into a hackaday.com comment, so I added this page.

IMG_6367

I added a push button so it would not swear constantly.  I got the speaker from a broken laptop.  The three AAA battery holder was from a friend’s ruined LED flashlight.

IMG_6368

I had to learn to use an Arduino Uno to program the ATTiny.  It was fairly easy.

Keeping Focused is proving to be difficult

I am in the middle of an Arduino, clock, humidity, and temperature project.  I also want to breadboard an ILI9341 display and an Arduino.  I should be finishing the clock before starting the other display.

Let me tell you about the clock.  Well, after I go clean and repair the heater.

I got the heater repaired.  There was a burned out wire connection bus.  I put a crimp splice onto it.  I think it goes to the heating element, or the fan.  You should see all of the LEDs and resistors to provide the fake flame effect.  Nice.  I’ll get to scavenge those later.  Now I have to hit the treadmill for a half hour.  BRB.

Now that I have that out of the way.  An hour of exercise today.  Half hour on the treadmill.  Earlier I used the Bowflex.

clock and soap box

I bought a 20×4 LCD to use with the Arduino Uno.  I already had bought a DHT11 from Adafruit quite a while back.  In the same purchase I also bought a potentiometer.  Wow, that was just the one I needed to use to adjust the contrast of the LCD.

I soldered wires to the connection points of the LCD circuit board, stripped the ends and stuck them in the half-size breadboard.  After adding quite a few jumper wires, the potentiometer and a resistor, I had the LCD up and running.  I ran a few sketches to see how the display worked,   One was the ‘Hello World’ sketch.  Then I was off and running.  I wanted to change the count up numbers, seconds since getting power, into a real clock.  That took a little bit of formatting the lcd.print statements.

After getting the clock numbers set up I decided to add the DHT11 to display humidity and temperature.  I added the DHT, a resistor, and some jumper wires.  The data from the DHT comes with decimal points.  I didn’t care about 41.00% humidity.  All I wanted was the integer for the humidity and degrees.  (int) helped with that.  It was that easy.

Next I decided to learn how to add custom characters to the LCD.  I wanted to have the degree symbol, °.  I read a couple of web pages and figured it out without too much hassle.  However, I could not get memory slot 0 to display.  So I stuffed the ° into 5.

I thought, “what about buttons to adjust the time?”  First I added a button for the minutes.  It also needed a resistor.  Pressing the button increments the minutes that are displayed.  After 59 minutes the next button press goes to 0.  Also, holding down the button only increments the minutes one time.  Then I added a button for the hours digits.  If the number is less than 10 a leading 0 is printed before the time digit.

Just for kicks I decided to see what a graphic in four characters would look like displayed in the top right corner.  I tried to make the Skull and Cross Wrenches logo of Hackaday.

I’ve decided to mount this all into a plastic soap box.  I’ve had the Clinique For Men’s soap box for years.  Maybe thirty?  I took some measurements of the LCD.  Drew them on a piece of paper.  Taped the paper to the lid of the soap box and drew around it with a pencil.  I mounted a cutting disk for a Dremel tool into a battery operated drill.  I figured the drill would rotate slower.  If it spun too fast the plastic lid would just heat and make a melty mess.  With the hold for the LCD roughed out I used the file on my Swiss Army Knife to file and shape the hole.

The next part of this project is going to be soldering all of the parts onto a predrilled circuit board and add a bareduino.  I’ll have to scav the main chip from my other breadboard.  Then I’ll order some more ATMEGA328p chips.  I am waiting for some sockets from Futurlec to arrive.  I’d hate to burn out the chip when soldering the legs onto the circuit board.  If I am running out of time I can get one from Radio Shack.  There is still one in Ukiah.

I’ll run this up the flagpole and see if anyone salutes.  The next post should be about being finished with putting all of this into the soap box.

PIR and electric lantern

PIR and Lantern

I wanted to be able to have an electric lantern turn on as I entered the room. I decided to use a PIR sensor (Pyroelectric (“passive”) InfraRed sensor) as the detector. First I had to use a breadboard and the parts to get it worked out.
IMG_6057 (1)
There is a second transistor on the breadboard as well as an LED and resistor. I didn’t use these in the project. They were left over from an Arduino project.

I am powering the PIR with 5v from a USB phone charger.  The three AAA batteries inside the lantern will light up the lantern’s LEDs.

A PIR has three pins.  DC+ in, Output, and Ground (-).  I connected the Output pin to the Base of the transistor.  At first I used a 2n3904 transistor.  This worked will when I as just using an LED on the breadboard as the light.  When I hooked up the lantern there was too much power and it bled through.

I put a guitar pick between one of the batteries on the positive side and put wires from the battery and the post where it was to touch.  It was like adding a switch.  The 2n3904 didn’t stop the electricity from flowing.  I had a 2n2222 on hand and ready that it can handle about three times as much and the 2n3904.

The schematic ends up looking something like this picture.PIR project schematic

Perhaps I should be using a resistor between the PIR and the Base of the transistor.  So far the transistor doesn’t seem to get hot or mind.

Once I had the design working I had to solder everything together. I could not find an electronics board with all the holes pre-drilled. I knew I have one somewhere. I decided to use an old iTunes gift card as the circuit board. I drilled holes in it for the PIR’s pins, as well as for the transistor. I used short jumper wires to create the wiring I wanted. To connect the DC + and – pins of the PIR I soldered short wires to them and poked the other ends up through holes drilled in the card. I used a USB cable taken from a broken mouse and plugged it in onto the exposed pins I just created. For the fires running to the lantern I soldered two wires to the collector and emitter of the transistor and poked the other ends up through the card. I then soldered longer wires to those newly created pins.

Gift card circuit board topGift card circuit board bottom

Now came the tricky part. I took a small piece of an expired credit card and glued aluminum foil on both sides. After the super glue was dry I checked to see that the foil was not touching from one side to the other. I soldered the two long wires to the aluminum, one per side. Now I had a separator that I would be able to use inside the battery case of the lantern. I removed one of the batteries from the lantern and put this little piece at the positive end of the battery while I reinserted the battery. I think using a copper clad circuit board would have been easier to work with. You know the kind I mean, copper on both sides so you can etch your own designs with some acid. I think the closest store that might have this in stock, on short notice, is about 45 miles away.

I read information about the PIR from Adafruit. (www.adafruit.com) I love the NeoPixel LEDs they sell.  They are easily programmed and are very bright.

PIR Lantern animated gif

I just had to have the Quad-Core Raspberry Pi

As soon as I heard about the Raspberry Pi 2 Model B+ I had to have one. I went to adafruit.com and got on the waiting list. Those things sold out fast. I received an email about a week later saying they were in stock. I immediately went online and placed my order. I could only get one. “One per customer.”, the sign said. Chris was going to have to wait.

In preparation for the new Pi I downloaded the latest raspbian and installed it to an SD card. Once I put the card into the new Pi I booted it up. Wow, was that ever fast! I expanded the disk space and set up the monitor settings. I kept it set to boot to console instead of X-window. Some of the stuff I do doesn’t need a desktop. I am happy with that.

I can set a VNC server and get into it with my iPad, or Mac.

Then I decided to share. I am hosting a Pi Day Introduction to Raspberry Pi at the Upper Lake Library on Pi Day. I have put out a few posters and the main library in Lakeport has put out a press release. I hope to get interested parties showing up.

I registered the Pi Day with raspberrypi.org and got contacted by Matt Richardson. He said he’s going to send (I have already received) stickers for the event. It feels so official. I hope to be able to start a user group out of this, or at least a programming group. That remains to be seen.

As for the stickers that Matt Richardson sent, I can’t wait to share them with the other Raspberry Pi enthusiasts. Thank you Matt!

Been Busy

Went up to Eureka to work. The office is “repaired” and people can move back in. I loved reacquainting myself with co-workers. I work with a great group of people. They like each other, mostly. To save the corporation money, I stayed at my daughter’s. That was fun, too.

I loved being able to show three of my Raspberry Pis. One of them is set up as a camera in a Lego case. I actually love that one. I guess I should figure out if I can set up the Raspberry Pi 2 with the camera. I am having fun with them.

On the 14th, PI Day, I am doing a Raspberry Pi demonstration at the Upper Lake Library. It is on the corner of Main and Second. Maybe it will blossom into a user group. I would LOVE that.

I am glad to be home and able to relax (relapse). Listening to Floater. Repaired the vacuum. Tasting wine. Loving life.

More Reading – HTML5, CSS3 and Javascript

I mashed on the code today a lot. Added HTML elements through Javascript code and changed the HTML interactively. I can’t believe how easy it really is.
I did run into a wall for a few minutes before retiring for the night. backgroundColor has a capital C in Color. When I couldn’t get the background color to change within a defined 400×300 rectangle I had to re-check the code. I was missing that C in two spots. What a relief to find that. It is always the simple syntax errors that cause the most damage.
Tomorrow is another day of working on the house, playing music and programming.
Today I tried my hand at crocheting. My stitches were way too tight. It took mw about six or seven times to get them loose enough. Trying to make a Cat Bus for Emily. I am working out the style of one of the legs.

Oh, since I can include code, here is the code from today. This first part is for the HTML part. The second part will the the Javascript.

var myButton = document.querySelector(“button”);
myButton.addEventListener(“click”, myClickHandler, false);
var whatColor = 0;
var body = document.querySelector(“body”);
var score = 0;

function myClickHandler()
{
score ++;
var output = document.querySelector(“#output”);
var divColor = document.querySelector(“div”);
if (score === 1)
{
output.innerHTML = “The button was clicked ” + score + ” time.”;
}
else
{
output.innerHTML = “The button was clicked ” + score + ” times.”;
}
output.style.fontSize = “50px”;
output.style.textDecoration = “underline”;
if(whatColor === 0)
{
output.style.color = “red”;
whatColor = 1;
myButton.style.color = “brown”;
myButton.style.backgroundColor = “#aaaaaa”;
body.style.backgroundColor = “#2222cc”;
divColor.style.backgroundColor = “#5555ff”;
}
else
{
output.style.color = “blue”;
whatColor = 0;
myButton.style.color = “#ff3333”;
myButton.style.backgroundColor = “#cccccc”;
body.style.backgroundColor = “#5555ff”;
divColor.style.backgroundColor = “#2222cc”;
}
}

Well, that didn’t work out quite well enough. The HTML stuff rendered instead of listed. I can fix it in the morning.
Using the code tag doesn’t work. Some stuff gets stripped out and some of the HTML gets rendered, and changed. I have read a few posts through google. I may need to install a plugin.

I ended up adding to Simple Custom CSS and having to force some inline styles to get the section showing code how I wanted it. I wanted non-horizontal wrapping and vertical scrolling, with horizontal scrolling if needed for long lines.
I accidentally hit publish which took it out of draft mode. Bother!

Reading and Reading and Reading

I have been reading HTML5, CSS3, WordPress books from the Upper Lake Library and from Kindle. There is a lot of information for me to process. I have been taking lots of notes. Once I return the books to the library I won’t have them as a quick reference.

One of the things that really caught my eye is the jquery file to include in a web page in case someone is using an older browser to help it display your page correctly. You can also do this with javascript. Using javascript will be quicker if you only have a few things that the older browsers don’t have already built into them. This is because they won’t have to download the full helper file.

Happy New Year 2015

It is almost midnight.  Linda is sleeping heavily.  I am very sleepy.  At one point I wanted to get coffee.  I stayed awake anyway on the way home from Operation Andrew. Emily said that Chris is really happy and appreciates it.  I went to Santa Rosa after noon and picked up Chris’s brother Andrew.  Then I drove up to Garberville to meet Chris and hand off Andrew.  Chris was so happy at the time.  He said, “I don’t know if I should hug you or hit you.”  I am sure they will be up for hours touching base with each other.  Andrew has to leave on Saturday to get home on time for work on Monday.

I only added colors to the text because there is an option to do that.  Checking upon it on the Text tab shows that inline <span style=””> </span> is used.

Third Raspberry Pi.

For Christmas Emily and Chris gave me a third Raspberry Pi.  This one is a B+.  It was made in the UK.  The other two are both regular B models.  The first one was made in China.  The second one was made in the UK.

I have to get another SD card for the B+.  Then I’ll get it up and running.  I guess I should start a Raspberry Pi group in the area.

Jovian Laser app sales so far

I checked this morning and there were 16 sales over the three days.  11 on the first day.  So, there is a difference in the look on the iPhone app and the web site.  The web site is a lot easier to view and seems to have a lot more information.  Also, floating over with the mouse displays some more information.  You can’t float over on the touch screen.  Maybe someone has figured out how to include mouseover on a touch screen, but a web page would have to have that coding included within.

Today I stopped by a friends’ house and had a cup of tea before heading home.  They asked to see the app.  I went out to the truck to get my iPhone and brought it in to let them play.  The man of the house played with it the longest all the while attempting to get a high score.  His wife was laughing and really enjoying him playing on the iPhone.

They enjoyed the simplicity of the game.  I read a message from my niece saying that her two daughters (2 and 4) enjoy playing the game.