This page is all about projects I have done with Raspberry Pi’s and Arduino’s. For those who don’t know a Raspberry Pi is a low cost ($35) credit-card-sized computer. It’s very capable for what is is and can be used in all kinds of electronics projects. It can even do a lot of things a desktop computer can do such as play games, surf the web, and word processing. I’m a still a newbie when it comes to Pi’s but I think I own about 7 or 8 of them to date.
As for Arduino’s they are an open-source electronics platform based on easy-to-use hardware and software. They can read inputs (i.e – sensor, buttons, etc.) and turn them into outputs. They can also control motor, servos, lights, and even publish stuff to the internet.
Below are a few of the things and projects I have done (or tried to do) with Pi’s and Arduino’s so far. (The newest projects are at the top on this page.)
I recently had an older family member who lived alone fall and they couldn’t get up. They were only discovered when my father tried to call them and couldn’t get them to answer the phone. Well my dad is getting up there in age and also lives alone… so this really got me worried. Plus… He’s not very tech savvy (couldn’t figure out an iPhone or even texting) and I know he hates to call me because he thinks he’s bothering me. So I thought I would try to make a DIY Just In Case SOS Alert system that he could just press a button to automatically send me a text to get “my” help during an emergency… or at the very least a basic call box he can use to get me to call him if he needs something.
I have a bunch of unused Raspberry Pi’s laying around which seemed like a good base for this kind of project. I also found a simple 433Mhz RF Wireless Relay Remote Control Relay on Amazon that would work as the “Emergency Button”. Combine these with a few other switches, LED’s, power supply, and a voltage converter and I think I can make a simple system that will do both things I want. While this will not be a “True” life alert system I figure it’s better than nothing and just a little peace of mind when I can’t stop and visit him.
The first thing I did was wire up some LED’s for a power indicator and a visual aid that the system is sending a message. To do this I start by adding a few 330 ohm resistors to some LED’s I had on hand.
I use the 3.3 volt output of my ATX Bench Top Power Supply to test out the LED’s to make sure I wired them correctly.
Once I had both LED’s wired and tested I covered the resistor and other leg with some heat shrink tubing.
I then used a Crimping Tool to add some Dupont connectors to the other end of the wires.
These make it easy to wire everything to the Pi.
Here are the two LED’s wired and ready to go. I used one shared ground for theses.
Next… I did the same thing for the switches. (only one shown)
Then it was time to connect everything to the Pi’s GPIO pin’s.
Future Notes to me =
The Send Button = GPIO 21
Emergency Button = GPIO 20 X
Shutdown Button = GPIO 2
Sending LED = GPIO 17
Power LED = 3.3V (Pin 1)
Black Wires = Any Grounds
X = Not Shown yet.
Next it was time to design a housing for all of the parts. I was able to recycle the design of the enclosure from my Soil Tester because it already fit a full sized Pi. (I thought about trying to use a Pi Zero W but wasn’t sure if I would need to used this wired as my dads WiFi is spotty.
Luckily I found design files online for the Pi and LM2596 Buck Converter so I just had to mock up the Wireless Relay to see if they would all fit in the box.
After the quick changes to the soil tester enclosure design I 3D printed out the new design for the SOS box.
The safe shutdown button was then just force tapped into the side of the enclosure.
The Pi was then mounted to the box with a few 2-56 screws. Before I go any further I think it’s time to figure out the code.
The Code
This is the code I am using… Keep in mind I have no idea what I’m doing most of the time so a lot of it was recycled from my Pet Feeder project but I changed the way the emails are sent to use a G-mail account because my Xfinity email account was having issues sending the text/email to my phone. Also to keep things simple it just sends a basic subject line message with no message body. There are two different messages that can be sent depending on the button used. The button on the box will just send a basic “Give Dad a call when you get a chance” message and if the remote fob button is press it sends an “Emergency” message. Let’s hope this one never has to be used. With the code figured out it was time to get back to the actual build.
This is the 12v wall wart I will be using to power everything in the box.
A quick test and it’s putting out 17 volts. (I checked another 12v wart and it was putting out 16V too so this must be the norm?)
I forgot to add the power cord hole in the design so I just drilled it out and added a grommet before inserting the wires into the box.
The wires from the supply will connect to the buck converter and I added another pair to jump the 12v power over to the remote receiver unit.
Because of the thicker double wires I had to drill out the connection points a bit on the converter.
Here the wires have been soldered onto the boards input side…
… and another pair of wires is then attached to the output side to power the Pi.
Next using a multimeter on the output wires the 5.1 voltage required by the Pi is set by turning the adjustment screw on the converter. (You have to turn this screw a surprising amount of turns to get it to adjust.)
A quick check of the other wires shows it’s still putting out 16v.
Testing out the Receiver to make sure 16v isn’t to much. Everything seems fine so far.
Next the converter is secured into the box.
Then I made up a few more jumpers for the receiver. (Black to Com, Orange to NO (normally open).
The 12V power is then wired to the Receiver.
After putting the Receiver in the Box… the orange wire is connected to GIPO 20 and the Black to a ground.
The 5V power from the Converter is then wired to the Pi using a 5V pin and another ground. (Get these backwards and you might let out the magic smoke as this by passes the boards power fuse.)
At this point it was ready to test and so far everything is working correctly.
Next it was time to print the cover. (The square block just holds the receiver in place.)
I added a piece of window screen over the vents just so nothing could get dropped inside.
The labels were printed separately and then glued in place. I was going to print them in different colors and then do color changes for the text but I decided it was easier just to print them in white PLA, paint them, and then sand off the paint (back to white) for the text.
The cover is held in place with a single 4-40 screw. Here you can see the hole for the antenna but I’m going to see if it even needs to stick out of the box first. Initial range testing in my house was pretty good even a floor down.
To finish it off I added some rubber feet to the bottom of it.
It’s pretty much done at this point but I’m going to go back and clean up/shorten some of the wiring and maybe share a few more of the grounds (especially from the cover wires) just so everything fits in the box nice and neat.
These are what the FOB’s look like. The receiver came with 2 so I’m using one on a lanyward that can be worn and the other will probably be a spare.
They are not crazy big which is nice.
Here is the final project (minus some programing tweaks maybe) ready for testing.
4/21/23 – Updates
I was having trouble with the reliability of the RPi functioning correctly and after noticing the little lightning bolt on screen I decided to try a better power supply as I don’t think the other one was putting out the 2.4 amps it was rated at. I found this Chanzon 12V 3A UL Listed power supply on Amazon so I thought I’d see if this fixes the problem.
I didn’t want to cut the plug off it so I just drilled a hole in the case to fit the DC power connector that came with it. This actually made jumping the wires to the two different boards much easier too.
The connector sticks out a bit from the case but this made it easy to use a piece of safety wire in one of the grooves to secure it in place.
Updated Code:
def reboot(t):
print("Rebooting in 20 Sec!")
time.sleep(20)
import subprocess
subprocess.call(["sudo", "shutdown", "-r", "now"])
# start system reboot at time (11:50pm) 24 hour format
schedule.every().day.at("23:50").do(reboot,'Reboot Complete.')
I also added this bit of code to make the RPi reboot itself every night too. Hopefully these changes will fix the reliability problems.
While this probably needed a better power supply anyway it turns out the problem was more of a WiFi issue… The box was too far from the router so I moved the box and just ended up plugging it in with a ethernet cable and it’s been working fine ever since.
I’ve always wanted to try and make on of those crazy Xmas light setups that I see people on the internet make so I figured I’d start with something small like a simple Xmas tree and maybe eventually work my way up to something Grander if I can get this to work first.
The lights for this project are going to be controlled with a Arduino UNO and and a SainSmart 8 channel Relay Module.
Hooking up the Arduino to the relay module is pretty simple. The VCC of the relay board is connected to the 5V pin of the UNO and then the 8 relay pins IN1-IN8 are connected to 8 digital pins on the UNO (2-9 in my case). A ground connection to the UNO is not necessary because I will be powering the relay module separately.
For this project I am going to be using an Anker 24W Dual USB Wall Charger to power both the UNO and Relay Module.
I had some old USB cables laying around that I will use to connect the boards to the power supply.
The wires on the USB cables were awful small so I just hacked off the ends and soldered on some thicker wires directly to the USB plugs. I thought about 3D Printing a new end cover but will wait to see if everything works before spending any more time on little details like that…
…for now I then used a little heat shrink tubing to clean everything up.
For the cable going to the relay module I added a DuPont connector to the other end. (This connects to the relay boards VCC and GND pins after completely removing the jumper from VCC JD / GND).
Power to the UNO is supplied with this other cable with a 2.1mm x 5.5mm Male DC Pigtail Connector.
Here is what the completed power setup will look like. (I did go back and redo the UNO power cable to soldered the thicker pigtail wires right to the USB connector.)
Next after a little help from Google I wrote a simple test code to flash every light on the board. (basically simulate turning on and off the relays.)
At this point everything looked like it should work.
For the tree lights I am going to be using these 12V LED strips. I thought about using normal outdoor Xmas lights but really didn’t want to play around with 120 voltage just yet.
To power all of the LED strips that I will be using (probably around 66 feet in total) I am using this MEAN WELL LRS-150-12 150W 12V 12.5 Amp Power Supply.
Next it was time to design the actual tree so I jumped over to Fusion 360 and did a quick and rough design of how things were going to go.
This is the star and hanger mount portion of the design. I’m not going to lie I didn’t put much effort into this and everything is probably going to be clobbered together.
Starting with the Star… it’s about 24″ wide so it was printed in 5 pieces to fit on my printers bed. (everything was printed in PETG)
This is what it will look like when assembled.
The back side has reliefs for little printed joiners. (it’s rough because PETG supports suck)
The joiners are super glued in place. It’s still a little flimsy but hopefully it works out.
I had some old white led strips laying around so I covered them in Kapton tape to make them yellow and then glued them to the star base.
The LED strips are then soldered together…
… testing as I go.
All wired up… I might add some more tip lights later as it looks a little weird here.
I am using a piece of aluminum for a hanger. Everything will attach to this with a few 4-40 screws. Here you can also see the star tips a quickly added.
This is where all of the LED strips will attach too.
I bought these cheap 8′ long Polystyrene Screen Molding pieces to attach the strips to. Hopefully these hold up to the winter elements.
I designed and printed a quick JIG to slice the moldings in half.
This allows the blade of the razor to slide down the middle of the molding to slice it in two without losing a finger.
After drilling a few holes the pieces are test fit into the star base.
So far so good….
Next it was time to attach the strips to the molding pieces. The strips have 3M sticky tape on the back of them…
… but I’ve learned in the past that this probably isn’t actual 3M tape because it doesn’t stick for very long so I also used some zipties every foot or so.
The LED strips come 16.4 feet long so once I cut them to 8 feet to match the molding pieces I solder on female DC Pigtail Connector to the other half.
Here you can see the molding pieces are attached with a 4-40 screw and the remaining LED strip piece with be secured with another zip tie.
To finish off the frame work I printed up a bunch of these clips.
The clip secure the light strips to a cross piece of 1″ molding.
There are two cross braces… one at the bottom and this one at the top. Hopefully these are enough to keep everything in place.
Now it was time to finish the wiring. Again I am using 2.1mm x 5.5mm DC Pigtail Connectors. These will make it easy to disassemble everything when not in use.
I start by connecting all of the negative ends together into a single ground wire.
Here are all of the 8 needed connectors for all of the LED strips.
After that I strip and bend a single wire for the positive side of power to the LEDs.
Relay Terminal Layout
This gets connected to the COMMON terminal for each relays.
Then the positive side of the pigtail connectors get attached to the Normally Open terminal of each Relay.
The power wires from the relays get connected to the 12v power supplies V- & V+ connections.
This mess is just for testing purposes.
The first test and everything looks like it’s working.
Now I just have to figure out how to cleanly stick all this stuff in this Plano box so its all weather proof while still being able to wire everything back up.
This is a quick design I came up with that should drop right into the box while still allowing me access to the wiring.
Here is the printed holder ready to go after installing a bunch of heat set inserts. I screwed up a few dimension for the plug holder but I made it work.
A quick test fit in the box and everything looks good.
The power supply and mains plug got mounted first.
Next was the UNO mounted vertically.
The relay module was mounted up top so all of the connections could be easily done once it was in the box.
I also installed a 10 amp fuse which should be plenty because all of the lights only draw about 5.3 amps.
Next wires were connected from one end of the plug to the main input for the powers supply.
I then stuck a big grommet into the side of the box…
…and the mains power cord was fed into the box and connected to the other end of the plug.
This is how everything fits ion the box so far.
More grommets and wires for the lights are fed in from the other side of the box.
Those wires are then connected to the relays. Connecting the ground to the power supply was a bit of a challenge.
Those wires were then soldered to the pigtails.
Here is the finished power/controller box.
The tree was then hung from my deck with the aluminum bracket show before.
I used some string to secure the bottom to keep it from swinging in the wind.
I stuck the box up off the floor under my deck table to help keep it out of the elements.
The power cord is plugged into this outdoor time which turns on at dusk and then runs for a set time before turning back off until the next day.
Here is a crappy video just to show all the patterns of the final program. The music was added post production just for the video, my setup is not that complex yet it’s just lights so far. There are also some branches in from of the camera which make it look like some of the light are out but they all work.
Overall everything worked great the only problems I had was it if got below 30°F the relay board would stop working until it warmed up. It wasn’t that the relays would actually freeze and stop working… I think it was something to do with the other side (control side) of the board because the LED’s wouldn’t even cycle through with the program.
This was my first full Arduino Project that I have attempted to do. I bought my first Arduino Diecimila probably 15+ years ago to learn on because I wanted to use it on an ROV but never got that far with it besides making some LED’s blink. After making a few projects with Pi’s and everyone telling me I should have just used an Arduino I finally decided to give a project a try with one. This Christmas I looked into buying one of those Automatic Laser Cat Toy’s you see on Amazon but all the reviews I read didn’t inspire confidence in purchasing one so I decided… how hard could it be to make my own?
I already had all of the major parts on hand that I needed. I had plenty of servo’s from my R/C days, the Arduino Nano was salvaged from a cheap laser engraver/cutter that I changed the control board on to use better software, and the laser I had laying around from a firearm project.
The first step was to hook everything up using a bread board to try and figure out how to code to make the servos move at random positions and speeds.
After a little help from Google I was able to figure out the code to make the servos do what I wanted to do.
The Code
With the code working I then designed the actual mechanics of the actual laser setup in CAD. (Fusion 360)
Few more design pictures.
The overall design.
Next it was just a matter of 3D printing all of the parts of the housings and servo mounts. I tried to keep things as simple as compact as possible.
The first step in assembly was to mount the Pan servo using a couple of 2-56″ screws. There are holes in the bottom of the base to allow access for the hex wrench to tighten the screws.
Next it was time to mount the Nano. Being a knock off Nano it doesn’t have mounting holes in the board so I just designed notches the board can slide into.
The other end of the board will be retained with this clip and screws.
Here you can see the mounted Nano. It is mounted upside down so I marked the pins that I will be using with a bit of paint.
Next a servo horn for the pan servo was slid in and super glued to the tilt servo mount.
That tilt mount/servo horn is then secured to the pan servo using a small screw.
The tilt servo can now be secured to the mount, again using 2-56″ screws.
The cover for the tilt servo is held in place with magnets. I did this encase anyone tried to lift the finished toy by the cover piece it will come off instead of putting undue stress on the servo horn holding it all together.
Now the Laser mount can be slide onto the tilt servo horn. (this is friction fit only)
The laser module is also just friction fit into the mount.
After feeding all of the servo wires into the housing I rewired the power wires of both of the servos into single DuPont connectors so they can connect to the single pins on the nano.
Then I just had to connect all of the wires to the correct pins of the Nano. The positive + servo wires (red wires) connect to the 5V pin, The negatives – (brown wires) to GND, and the signal (Yellow wires) connect to pins D9 & D10.
The laser draws hardly any power so it gets connected to the Nano too using the 3.3V pin and the other GND pin.
Time for a quick test.
The cover is is secured with magnets (not shown).
The last thing I did was to add rubber feet to the bottom to keep it from sliding around if the servos move to fast.
I planned on powering this whole setup with just a phone charger type power bank but…
… I guess the whole setup doesn’t draw enough power so the power bank won’t stay on for more than 30 seconds. I think peak was .35A at best but it only stays there for a second while a servo is moving before dropping to an avg. of .07A. I could probably throw a resistor in the mix somewhere but for now I’ve just been using a larger power bank with two outputs and charging my phone at the same time.
The Finished Project.
Rear View
Left Side
Front View
Quick GIF of it in action until I get some footage of the cat’s reaction.
̶R̶a̶s̶p̶b̶e̶r̶r̶y̶ ̶P̶i̶ *Arduino Controlled Robotic Arm
When I was a kid I was given a Radio Shack Armatron robotic arm as a gift and I absolutely loved it. I figured it was time to get another robotic arm and relive the memory and learn some more Pi programing at the same time.
This cheap little robotic arm popped up in ad from Gearbest on Instagram one day so I figured what the hell it might be fun to play with. There were a few different versions but I bought the one that came with servos for like $18 shipped. (straight from Hong Kong.)
It took a few weeks to get from across the big pond but a little box finally showed up with a bunch of acrylic parts and a bag of screws. It took probably an hour and a half to put it together with most of that time going to removing the protective covering from the pieces. As usually the instructions (found only online) were not the greatest and some of the pieces were mismanufactured. (holes that should have been for tapping were actually thru holes so some extra hardware like longer bolts and nuts were needed.) After putting it together it was on to learning some more Programing.
To control the arm I’m using a Pi3B and an Adafruit 16-Channel PWM / Servo HAT and another separate 5volt 2A wall wart for servo power.
After getting everything soldered together on the hat I hooked everything up and ran some test programs that Adafruit supplies.
Using the examples from the test script (and google) I figured out the basic programing to get it to move (somewhat) with the keyboard inputs but it’s pretty jerky and kinda flimsy as you can see in this gif. Another issue I had is one of the servos was DOA so I couldn’t get fully range of movement out of everything.
I didn’t expect much for the 18 bucks and while it was kinda of fun to build and worth the try I don’t think I’d recommend buying one of these… overall the are pretty much crap and you wouldn’t be able to manipulate much with it. I haven’t given up on the idea though it’s just time to try something I tad bit better as far as the arm goes.
I found this 3D printed robotic arm on Thingiverse designed by Carlo Franciscone from Italy. It uses better/larger servos so it looks much more promising. I’m in the process of printing the parts now and I ordered the new servos today so I’m excited to give this one a try.
It took a full day of printing but I got all the parts printed for the arm. I went with a red and black color scheme.
After mocking up the arm for the first time I ran into some issue (for me anyway) with the design. The limits of movement of the arm keep the gripper from reaching the table top so I wouldn’t be able to pick up small items with the way it is.
Carlo is gracious enough to share all of his files on Onshape though so modifying the design is pretty easy. These are the three parts that needed modifying.
The biggest issue I found is with the triangle link. I enlarged the pivot area in the link for the main arm so it would be able to rotate more before hitting the arm.
I also opened up the front of the arm to allow the Trial Front Link to rotate more and I changed the angle on the rear of the top on the arm just so it prints better.
A small section of the Trial Front Link was removed too to allow it a fuller range of motion. This should allow me to manipulate things that are closer to the base.
This picture shows the extended range of movements I accomplished by modifying those three parts. The gripper will actually be able to extend below the table top now. I’m working on a lower base extension for the Pi to be housed in so I needed it to be able to reach at least an inch lower.
I couldn’t find the required 606zz bearing for the base so I just designed my own and used BB’s for the Balls.
The original gripper looked a little limiting with such small finger so I’m not going to use this one.
This is a parallel designed gripper that I designed for one of my Rov’s but I modified the design to work with a servo just like the original one. (Fun Fact – This gripper was designed to replicate the original Armatron gripper so I though it only fitting to incorporate it into this arm too.)
This picture shows with the top cover removed so you can see how the gears work inside to open and close the grippers fingers.
Here is the printed and assembled new gripper. Everything except the finger pads were printed in PLA those where printed in a flexible filament so they would hopefully have more of a rubbery grip to them. The fingers open up to about 1.5 inches.
Here you can see a little better how the gears work.
This is the basic design of the lower base extension where the Raspberry Pi will be housed. I just need to add the standoffs for the Pi. I’m not sure if it will work out yet as I need to finish assembling the Arm first before I can figure out if I have room for all the plugs.
Here is how the Raspberry Pi Show fit when mounted. Hopefully I have enough room for the power and servo plugs.
I finally got everything assembled and so far everything is working out great.
I still need to figure out how to run the servo wires and where they will enter the base.
The gripper mounts with a single screw through the front link (not shown) so it’s easy to change out if you wanted to use different designs for different situations.
I got the base printed and the Raspberry Pi mocked up for fitment. I might run into some issues with the power plug for the servo hat, I might have to cut off the plug and wire it to the board direct. I had to position the Pi in this configuration so the servo plugs would fit up into the original base when plugged into the hat.
Update 2/1/2022 – Switching to Arduino Control
I’m finally getting back to this project and I have decided to switch to using an Arduino Uno for control. It seems like a much easier method as far as the programing goes. I’ve been writing code and testing things out in Tinkercad Circuits.
With a little help from Google this is my initial code for testing.
Some bread board wiring for testing.
Quick video of the first test. It’s far from a precision machine but much less jerky than that cheap arm that’s for sure. I have some power issues to figure out still… I can only connect two servos or it resets. I am running external power with a 3A phone charger plug so I’m not sure what the problem is yet.
Once I had everything working (close enough) I jumped back into CAD to design a controller for the Robotic Arm that can also be 3D printed. This was designed along the lines of an Xbox type Controller.
The internals are pretty basic and everything will operate off 12mm tactile micro push button switches.
Simple retainers will be used to hold the switches in place. (screws not shown)
Here are the first printed main pieces of the controller.
This is what the internals look like after cleaning up all of the supports and installing a bunch of heat set inserts.
This is one of the tactile micro push button switches (w/original button caps) that I will be using along with all of the switch retainers.
This is how the front switches mount and how the simple retainers hold them in place.
Here are all of the switches for the D pad.
After installing all of the switches and retainers this is how it looks.
The printed button press caps. These will just snap onto the tactile switches.
Here you can see how the button caps look installed and some of the bare tactile switches.
After screwing on the back of the controller body this is the almost finished controller.
Here is the front side. I used the original button caps for the front switches. Now I just need to wire everything up.
I’m using cat5 cable to wire the control (gotta love the easy color coding) so I made a quick and easy diagram to follow during wiring.
The first step was just to strip the cat5 wires out of the main jack and feed them through the rubber bushing.
Wiring was pretty simple… a cat 5 wire is soldered to one pole of each switch and a resister to the other side. With the resistors all tied to a single ground wire. Its a little sloppy looking but should do the trick.
On the other end of the Cat5 wires I crimped on some DuPont connectors.
The wires minus the ground were then inserted into a 8 pin male receptacle.
To clean up the wiring I just used some split loom tubing to neaten everything up.
Being relatively new to Arduinos I did not know there was a space between the #7 and #8 pins so…
… I had to redo the connectors using separate 3 and 5 pin ones.
Here they are plugged into the Arduino ready for testing.
Here are a few pictures of the base extension…
… although I may have to redesign the internal mounts to fit the Arduino now.
This is another basic Raspberry Pi project I put together to test out a soil moisture tester. My idea was to plant some vegetables at my parents house (I don’t get enough sun) and use this system to keep them watered. I wanted the entire system to run off a solar/battery set like I used on my garden fountain but so far I’m still only in the testing phase so the solar part will probably have to wait until next year. I used the same system image from my Petfeeder and just changed the code a bit to work for this. It checks the moisture twice a day emails me the results and then adds water if needed.
Here is everything mounted in the 3D printed case.
Everything is wired with jumpers.
(these pictures are just so I remember how I wired everything.)
The moisture sensor board just sits on a post in the case and is held in place by the one lid screw when the lid is mounted.
Once the lid is mounted I can still see the power and sensor Leds.
I super glued a piece of screen over the vent holes just to keep anything from falling in the case.
I had to make a special two piece wire stay for the sensor wire because of the plug on the end required a square hole in the case to fit through.
These two pieces just fit around the wire and then fit into square hole in the main case.
A single small zip tie then holds everything securely in place.
The water sensor is then stuck into the soil were it can monitor the moisture. I chose this sensor over the other cheap ones out there because it’s suppose to be corrosion resistant (but only time will tell). Right now I am only using it as a digital sensor so it’s either wet or dry. My goal for later is to learn how to use it as an analog sensor but I have to learn how to use a ADC MCP3008 first. You can also so the 3D printed spray nozzle in this picture.
This is a cross section of the simple printed nozzle.
For testing the nozzle is just stuck in the dirt with a peg and the hose is clipped to the planter.
The pump is just dunked in a bucket for now. I had a 5 gallon water cooler jug I was planning on using but the pump wouldn’t fit down the spout so this is it for now.
This is my test subject…. I have no idea what it is (some kind of grass?) I planted zucchini seeds in this planter but I think the squirrels dug them up and then this thing starter sprouting so I left it be to see what it turned into. What ever it is it’s getting tall.
Here the pump is on and spraying out the nozzle. It’s not the best spray pattern but for testing it works.
The pump is just hooked to a 12v battery through the relay for now.
I have everything stuck under the table but I also covered it with a plastic food container to protect the electronics from the rain. Now the testing begins…..
The (Digital) Code
(insert downloadable SoilDigital.py here)
#!/usr/bin/python2
import schedule #setup running tasks at certian time
import time #set up the time (internet required)
import smtplib #something to do with sending emails
import RPi.GPIO as GPIO #sets up the GPIO pins
from datetime import datetime #get the time from the internet?
now = datetime.now()
channel = 21 #signal pin for sensor board (pin40 GPIO 21)
GPIO.setmode(GPIO.BCM) #set GPIO to Broadcom SOC channel number
GPIO.setup(channel, GPIO.IN) #set as input
print ‘%s/%s/%s %s:%s:%s’ % (now.month, now.day, now.year, now.hour, now.minute, now.second) #prints time on screen
# start of soil check process
def soiltest(t):
print(“Checking Soil”)
if GPIO.input(channel): #if soil sensor is not triggered (no water detected) turn water on and send email
GPIO.setwarnings(False) #disables warnings
print “Start Water”
GPIO.setup(17, GPIO.OUT) #signal for relay board (pin11 GPIO 17)
GPIO.output(17, GPIO.LOW) #turn motor on
time.sleep(10) # run motor for x seconds
GPIO.output(17, GPIO.HIGH) # turn motor off
from email.mime.multipart import MIMEMultipart #Start of Email
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
fromaddr = “YourEmailAddress” #I just email my self
toaddr = “YourEmailAddress” #so these are the same
msg = MIMEMultipart()
msg[‘From’] = fromaddr
msg[‘To’] = toaddr
msg[‘Subject’] = “Soil Test Results” #what the email subject line says.
body = ‘Water Was Added.’ #what the email message says
msg.attach(MIMEText(body, ‘plain’))
part = MIMEBase(‘application’, ‘octet-stream’)
encoders.encode_base64(part)
server = smtplib.SMTP(‘YourEmailSeverInfo’, 587) #outgoing email server field and port#
server.ehlo
server.starttls()
server.login(fromaddr, “YourEmailPassword”) #email password
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print(“Email Sent”) #End of Email
else: #if soil sensor is triggered (water is detected) just send email
print “Water Detected”
from email.mime.multipart import MIMEMultipart #Start of Email
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
fromaddr = “YourEmailAddress” #I just email my self
toaddr = “YourEmailAddress” #so these are the same
msg = MIMEMultipart()
msg[‘From’] = fromaddr
msg[‘To’] = toaddr
msg[‘Subject’] = “Soil Test Results” #what the email subject line says.
body = ‘Moisture Level OK.’ #what the email message says
msg.attach(MIMEText(body, ‘plain’))
part = MIMEBase(‘application’, ‘octet-stream’)
encoders.encode_base64(part)
server = smtplib.SMTP(‘YourEmailSeverInfo’, 587) #outgoing email server field and port#
server.ehlo
server.starttls()
server.login(fromaddr, “YourEmailPassword”) #email password
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print(“Email Sent”) #End of Email
return
# Run 1st Soil Test at time (6:30am) 24 hour format
schedule.every().day.at(“6:30”).do(soiltest,’Running Soil Test’)
# Run 2nd Soil Test at time (6:00pm) 24 hour format
schedule.every().day.at(“18:00”).do(soiltest,’Running Soil Test 2′)
while True:
schedule.run_pending()
time.sleep(60) # wait one minute
11-21-18 = UPDATE
It turns out using the sensor in Digital mode wasn’t really accurate enough and it wanted to water almost every day even if the soil was visibly wet. I probably could have adjusted it with the onboard pot but I really want to learn how to do it use it as an Analog sensor so I bough this ADS1115 Analog-to-Digital converter to try.
I got the converter all solder up and wired in (except for the soil sensor) at this point now I just need to figure out the new code.
I finally figured out most of the new code and modified the case to fit the new sensor and finished wiring everything up. The code still needs a little bit of work… I need to figure out how to change the value to a percentage and I also need to determine if the sensor is even calibrated correctly.
The (Analog) Code
(insert downloadable SoilAnalog.py here)
#!/usr/bin/python2
import schedule # setup running tasks at certian time
import time # sets up the time (internet required)
import smtplib # something to do with sending emails
import RPi.GPIO as GPIO # sets up the GPIO pins
import Adafruit_ADS1x15 # Import the ADS1x15 module.
adc = Adafruit_ADS1x15.ADS1115() # Create an ADS1115 ADC (16-bit) instance.
from datetime import datetime # get the time from the internet?
now = datetime.now()
channel = 21 # signal pin for sensor board (pin40 GPIO 21)
GPIO.setmode(GPIO.BCM) # set GPIO to Broadcom SOC channel number
GPIO.setup(channel, GPIO.IN) # set as input
# Choose a gain of 1 for reading voltages from 0 to 4.09V. # Or pick a different gain to change the range of voltages that are read: # – 2/3 = +/-6.144V # – 1 = +/-4.096V # – 2 = +/-2.048V # – 4 = +/-1.024V # – 8 = +/-0.512V # – 16 = +/-0.256V # See table 3 in the ADS1015/ADS1115 datasheet for more info on gain.
GAIN = 1
# Start continuous ADC conversions on channel 0 using the previously set gain value.
adc.start_adc(0, gain=GAIN) # Once continuous ADC conversions are started you can call get_last_result() to # retrieve the latest result, or stop_adc() to stop conversions.
print ‘%s/%s/%s %s:%s:%s’ % (now.month, now.day, now.year, now.hour, now.minute, now.second) #prints time on screen
# start of soil check process
def soiltest(t):
print(“Checking Soil”)
start = time.time()
while (time.time() – start) <= 10.0: # Poll the sensor for 10 seconds.
value = adc.get_last_result() # Read the last ADC conversion value and print it out.
print(‘Channel 0: {0}’.format(value)) # Prints the value to screen
time.sleep(1.0) # Sleep for a second (so it reads the sensor tens times.)
while True: # Read the last ADC conversion value and print it out.
value = adc.get_last_result()
print(‘Channel 0: {0}’.format(value))
if value > 20000: # if soil sensor is not triggered (no water detected) turn water on and send email
GPIO.setwarnings(False) # disables warnings
print “Start Water”
GPIO.setup(17, GPIO.OUT) # signal for relay board (pin11 GPIO 17)
GPIO.output(17, GPIO.LOW) # turn motor on
time.sleep(20) # run motor for 20 seconds
GPIO.output(17, GPIO.HIGH) # turn motor off
from email.mime.multipart import MIMEMultipart #Start of Email
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
fromaddr = “YourEmail@WhereEver.net” # I just email my self
toaddr = “YourEmail@WhereEver.net” # so these are the same
msg = MIMEMultipart()
msg[‘From’] = fromaddr
msg[‘To’] = toaddr
msg[‘Subject’] = “Soil Test Results – Water Added” # what the email subject line says.
body = (‘Channel 0: {0}’.format(value)) # what the email message says (sends last sensor value)
msg.attach(MIMEText(body, ‘plain’))
part = MIMEBase(‘application’, ‘octet-stream’)
encoders.encode_base64(part)
server = smtplib.SMTP(‘YourServer.WhereEver.net’, 587) # outgoing email server field and port#
server.ehlo
server.starttls()
server.login(fromaddr, “YourPassword”) # email password
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print(“Email Sent”) # End of Email
else: # if soil sensor is triggered (water moister is detected) just send email
print “Water Detected”
from email.mime.multipart import MIMEMultipart # Start of Email
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
fromaddr = “YourEmail@WhereEver.net” # I just email my self
toaddr = “YourEmail@WhereEver.net” # so these are the same
msg = MIMEMultipart()
msg[‘From’] = fromaddr
msg[‘To’] = toaddr
msg[‘Subject’] = “Soil Test Results – Water OK” # what the email subject line says.
body = (‘Channel 0: {0}’.format(value)) # what the email message (sends last sensor value)
msg.attach(MIMEText(body, ‘plain’))
part = MIMEBase(‘application’, ‘octet-stream’)
encoders.encode_base64(part)
server = smtplib.SMTP(‘YourServer.WhereEver.net’, 587) # outgoing email server field and port#
server.ehlo
server.starttls()
server.login(fromaddr, “YourPassword”) # email password
text = msg.as_string()
server.sendmail(fromaddr, toaddr, text)
server.quit()
print(“Email Sent”) # End of Email
return
# Run 1st Soil Test at time (6:30am) 24 hour format
schedule.every().day.at(“6:30”).do(soiltest,’Running Soil Test’)
# Run 2nd Soil Test at time (6:00pm) 24 hour format
schedule.every().day.at(“18:00”).do(soiltest,’Running Soil Test 2′)
while True:
schedule.run_pending()
time.sleep(60) # wait one minute
I recently bought a Palette 2 Pro for my 3D printers which allows me to print up to 4 colors at once so I made a new cover with colored text while testing the new features.
I’ve dabbled a little in a few simple Pi projects that were mostly cut and paste before but this was my first full blown project that I had to figure out how to code for. The feeder was designed to dispense food three times a day at specific times and after each feeding it will email me a picture to make sure the food is in the bowl. The main dispenser is a Zevro Dry Food Dispenser which I then powered with a simple geared motor. The motor connects to the Pi via a relay board. The code was pretty easy to figure out (with a little googling anyway). The only part I trouble with was getting the program to run automatically when the Pi was turned on but I finally figured it out with a little help from Reddit. (Unfortunately I really can’t remember what I did to get it to work.)
Overall I am very pleased with how everything came out. I wanted a nice clean looking finished product and I think I achieved that.
The dispenser works of off a rotating paddle shown here.
Every thing is powered off the single 2.5 amp wall wart.
The base, motor mount, camera mount, and feed chute were all custom designed and 3D printed.
The printed camera mounts in place of the original handle.
Here you can see the feed chute and the little black button toward the bottom of the base is the safe shut down button for the Pi.
There is a manual feed button on the top which is mainly for aligning the rotating paddle at start up. The red Led is just to show it is plugged in and powered up, (little did I know that I’d be able to see the Pi’s Leds through the case) and the green Led shows that the program is currently running.
The motor mount is mounted with 3 screws. I will eventually make some thumb screws to make removal of the motor easier as the motor has to be removed first to be able to then remove and clean the hopper and paddle.
If you are interested in seeing the Build Process click HERE.
STL files for this project are available at Printables and can be found HERE.
This is a time lapse camera using Pi-Timolo and it can do Timelapse, Motion, and Lowlight. So far I have only done a few time lapses with it though. The case I designed is similar to my other case but this one uses a short Pi cable.
This project also uses a Pi Zero W and both the camera and Pi fit in the 3D printed housing.
This design of this case also allows me to use some different add on Lens. This one is a clip on 0.45x Wide Angle Lens…
…and unscrewing the Wide Angle Lens turns it into a 12.5x Macro Lens. (I found this on Amazon HERE.)
I also have these which are a Fish Eye Lens, Wide Angle Lens, Macro Lens (not shown), and a Telephoto lens. (These were also found this on Amazon HERE.) These stick on with a magnetic washer base but I still have to test these.
The base on this one also has room for a 1/4-20 nut for use with a tripod.
Short loop of a test during the Connecticut River Ice in 2018
I tried to get the sunset in Treasure Beach Florida but the clouds didn’t cooperate.
Macro Lens Test…. has some weird lighting issues though.
I found this LANDZO 7 Inch Touch Screen for the Pi on Amazon and though of trying to make a DAKboard. A DAKboard is like one of those digital picture frame but better. Besides displaying your favorite pictures it can do your Google calendar, your To Do List, Weather, and a Newsfeedst. Normally you would run this on a converted laptop screen but I thought this would be a good way to go because it’s smaller and would run off a single small wall wart that is used for the Pi.
I designed a Frame to fit the screen and printed it out of woodfill filament which I was going to stain after it was done.
The frame was thick (a little less than 1.5 inches) but it was going to accommodate the screen and the Pi attached to the back cover. I had to make my own HDMI cable so it would fit in the frame without making the boarder too wide.
Unfortunately after all of that DAKboard really doesn’t work with this screen size as it cuts everything off. (either that or I can’t figure out the correct settings.)
This is what it’s suppose to look like on a full sized monitor. They do have a custom size feature but its only for the premium subscription and I’m not sure if it will work or not so I’m not willing to pay for it yet. I’ll probably come back to this project at another time but I might just try the magic mirror thing instead…. that might work better with this screen.
MotioneyeOS turns the Raspberry Pi into a video surveillance system. I’ve been playing around with two of these setups just for fun. I have one running a duel camera setup on a Raspberry Pi3 in the front of my place. I just have it in a simple 3D printed housing I found online with a Pi NoIR Camera V2 propped up in a front window.
It also has a Day/Night Vision dome camera attached to it too. This one is pointed at my front step to keep an eye on my Amazon deliveries. (Not that I’ve ever had a problem.)
I have another setup watching my back door that runs off a Pi Zero W. The PI0’s are even smaller than the RPi’s and still have a lot of the same features plus they are only $10.
I put this one in another simple 3D printed housing that I designed.
The camera and board both go in the housing making it very compact.
Here it is ready to go. The nut in the bottom is to attach it to a tripod.
Here it is attached to a simple tripod for testing.
Everything works off of wifi but I didn’t want to drill any holes in the house to run power so I just used a light bulb adapter and plugged it into the outside light fixture.
I then painted the dome white so you can’t even tell it’s a camera.
If you look close you can see the window I left unpainted for the camera though. I have the camera set up to write to an external hard drive in the house so even if the camera were stolen or destroyed I still have the footage.
Here’s what the view looks like from within the Motioneye GUI. (I can keep an eye on our friendly neighbor cat that I build an insulated shelter for.)
Octoprint is a great little setup that allows you to control your 3D printers while running off a Raspberry Pi. This allows you to not tie up your main computer while printing. I am using Raspberry Pi 3’s with my printers, they are housed in 3D printed housings that attach to the side of the printers.
Octoprint allows you full control over the printers through a web browser. This allows you to control them with even a tablet or a smart phone… even remotely away from home if you’re crazy enough. You can also view your actual part being printed live via an attached camera. I use cheap Logitech C270 720p Webcams for this.
I have all my printers on TP-Link HS100 Smart Plug so I can turn them on remotely (I do everything only when I’m home though) and warm them up. I can watch the temps on Ocotprint to know went they are ready to go so I then run downstairs to start all the prints. These days even Octoprint can control the plugs and automatically shut the printers (and everything) when the print job is complete.) It’s a great little program and I highly recommend it if you have a 3D printer.