Good news everyone, another step completed in my window garden. This is just a plain PIC 16F877A microcontroller with a 20MHz resonator and a character LCD. There is also a big photo-resistor for shits and giggles and some neat buttons. I got a dual relay board from eBay to turn the pump on and off, and an extra socket for a light down the road.
Inside the outlet box and wall plate I gussied up are the 120V mains. After triple checking with a multimeter and several websites, I made sure the neutral and hot sides of the plug were wired correctly. Neutral being white, the widest blade of the plug and silver tab on the socket. The hot, black side is switched and is the brass tab. To have the two sockets independent, clip the jumper between the hot side only.
So far, this is an overly complicated setup to turn one thing on and off occasionally. I’m working on my own version of a soil moisture sensor (I wasn’t too happy with the plaster version). Then I was thinking of using it as a Neural network experiment to learn to control itself using a variety of data.
… and no post. Well, my class on Fuzzy Systems is over
and I did GREAT and hopefully I’ll have some neat projects on that later (the final wasn’t so hot). You know, something useful like a lottery number predictor or a way to cheat at blackjack. Also, I was preparing my fort for winter and something else I forgot, so I’ve been kinda busy. Now that class is over, maybe I’ll improve the PIC-a-sketch or get the other larger LCD w/ a touch screen I got off eBay. Oh, and I’ll be unemployed between now and February, so I can’t wait to live it up on unemployment like I’ve been hearing about. Apparently, the captain of the pirate ship I serve aboard is scuttling the ship the owner didn’t pay bills/taxes/401k/loans and is being taken over by the bank/IRS. He must need a tax cut…
I’ve been struggling getting a stupid rotary encoder setup as my input for a PIC 18F4580 board , and have finally got it. A while back I had one working, but the code wasn’t very well written. I wanted something more portable and quicker for an ISR than switches, if-else if chains and tables to figure out the direction. At mbed.org, the cookbook section on QEI had the answer by XORing the right bit of the last state with the left bit of the new bit. This gives 0 when turning CW and 1 for CCW.
So for the hardware, channel A & B are connected to bits 4 & 5 on Port B to take advantage of the interrupt on change feature. A button is available on the encoder, so that is hooked to bit 0, which is an External interrupt pin. Since the encoder and button are seperate interrupt events, the ISR will check which one occurred and then call that function. The LCD is a Nokia 6100 knock-off from ebay using a driver from Atomsoft. I modified it slightly for my evil purposes, but you should get it from his blog, so I’m not posting it with mine. The other stuff on the board isn’t implemented for this project, but will be soon!
Just the test screen and a homage to the Commodore 64. The two numbers below “Ready” are the number of interrupts for button presses and the encoder, respectively. Last and New are the states of the encoder, and Rotary# is to see if the function actually adds and subtracts by turning CW & CCW.
The first Labor Day weekend project is complete! This solves (at least somewhat) the problem of lighting at my nice workbench I made over a year ago. I’m pretty jealous of the lights in a dentist office that swings around on a boom, but I’m sure they cost a fortune. So here’s my copy using some cheap lumber, 1/4-20 bolts and scrounged material.
No need for plans or drawings, the first two segments coming from the clamp are 18″ and the last two are 12″. Pop a 1/4″ hole in each end, then paint it black. Out of my junk box was the clamp that conveniently holds a piece of metal rod. With a little modifying, two copper pipe clamps holds one end down ,while letting it rotate. Finally, the light source are two 1W Luxeon Star LEDs driven by a cheap little board off eBay and a 12V wall wart, also from the junk bin. A fender washer was used to hold the LEDs, that also had to be adapted. The ID was to small for the scrap section of threaded rod, until Mr. Tap came by.
Obviously there is room for improvement. I’ll probably pick up some springs and eyebolts to add some tension to the segments and eventually get some brighter or more LEDs down the road. The wiring solution isn’t too elegant either. Anyways, its many positions available should make it mighty useful.
I’m imagining lots close calls and crashing, so I’ll need at least two of these. Anyways, not as heavy-duty as I was hoping, but they are quite good candidates for modding. The whole thing unscrews apart, with plenty of space for a big LED! For now, I’ll be putting one by the computer and the other will be mounted to my forehead or grafted to my arm.