Advertisement

Monday, November 11, 2013

Fixed Python Environment Variable Problem

I spent some time working on the python code for the HESA program tonight.  I want to have a sub-folder called modules to store re-usable code.  That way, I can have program code in its own folder without duplicating functions.

Up until now, when I tried to import code from the modules folder, it would not find the file.  I finally figured out how to change the path environment variable so the program finds the module files.

Here is the code.

# Load libraries 
import sys 
sys.path.append('/home/pi/python/modules') 

After this the import command will look for files in the current folder and the modules folder.

HESA Circuit Does Work in Water

When I tested the water detection circuit for my Home Environmental Sensor Array at the Makerspace yesterday, I used distilled water from a water bottle.  That is probably why the pi did not detect a current.

I setup the HESA at home and tried some water from our well.  At first, the HESA did not detect any electricity.  I left the leads in the water for a few minutes and it suddenly worked!  The HESA detected the current and shut off the light I connected to the outlet.  After that, the circuit always detected the current.  Maybe the water needed to get a bit electrified first.

Next, I got some water from the crock that I eventually want to put the sensor in.  That water should have more saline and iron in it making it a bit more conductive.  The HESA took a minute to work in that water as well but after a few minutes, the circuit worked and very consistently.

So, I'm feeling better that the circuit will actually work as designed.

Now, I can focus on the PCB and enclosure.

Sunday, November 10, 2013

Started Circuit Design to Etch a Circuit

The Milwaukee Makerspace has a CNC Engraver that can be used to make circuit boards.  The wiki for the engraver says that there is software called DipTrace on the computer.  I assume that this software is used to create the PCB design.

I downloaded the software and installed it on my Linux laptop.  The program is made for Windows but my Linux OS automatically launched Wine to install the program.  Cool!

I spent about an hour designing a simple circuit on the PCB.  I was able to figure it out without reading a manual.  If I make it to the Makerspace this week, there might be someone there who can help me take the next steps and use the Engraver.


HESA Circuit Does Not Work in Water

My wife and kids were all gone for the afternoon so I took the opportunity to head back to the Makerspace and work on the Home Environmental Sensor Array.

First of all, I spent a few hours working on the power supply enclosure.  I redid the wiring slightly to power up both the PowerSwitch Tail relay and the Raspberry PI.  The picture on the left below shows the PSU enclosure rewired.   There are some bare wires that will be wired in to the PST.  There are also wires with connectors on the end.  They will plug in to a USB power plug for the raspberry pi.  The red and black wires connect to the fan.  The pi will power that.  

The middle picture shows the PowerSwitch Tail wired in to the box.  

The picture on the right shows the whole project wired up and working.  You can see the wires plugged in to the USB power converter for the pi.



One problem I can see is that the PSU is not going to be big enough for this project.  I am thinking that I would like to try cutting apart two PSUs and combining them into one big project box.  I talked to Dan at the Makerspace and he thinks it should be doable.  I would use a cut-off saw to cut one end off of each PSU.  Then, I would use the TIG welder to connect them together.  Should be a fun project to learn to use some metal working tools.

Another problem I had is that the circuit does NOT work to detect electricity in water.  It works great when a wire is used to complete the circuit.  However, when I put the end of the wire in a small cup of water, the pi does not detect a current coming in.

Someone told me that I need a potentiometer in the circuit so I can variably adjust the resistance.  I'll have to research this some more.

Finally, I have started thinking about how to make a circuit board for this project.  There are basically two options.  First, I could solder all the components and connections on a circuit board like the one to the right.  Or, I could make my own circuit board using the Makerspace's CNC Engraver.  The Engraver may be more work but I would be learning a new skill, a new machine, and possibly have a way to make more of the circuit board quickly.  I might try both methods because I can.

Friday, November 8, 2013

Started Second Tardis

I started 3D printing a second Tardis. Now that I know what I am doing on the 3D printer at the Makerspace, they are coming out much better.  This time, I am printing the sides with 90% infill to make them stronger.  

As you can see from the picture, the blue filament ran out after the first print so I switched to green.  They will all get spray painted navy blue when all the pieces are printed.

I hope to put electrical wiring in this Tardis to make it light up.

By the way, these three pieces took a bit over nine hours to print.

HESA Works!

I was working on the Home Environmental Sensor Array at the Milwaukee Makerspace today.  (I took the day off so I was able to make some good progress.)

I had an idea to use an old computer power supply as a project box for the HESA.  It makes sense because I need an enclosure to put the parts in, 120v power, an on/off switch, and a fan.  The power supply box has all of that.  I hope to install all of the parts inside the power supply box and then mount it to my wall.  This includes the PowerSwitch Tail relay, the raspberry pi, and the circuit board.

After taking of the electrical components out of the power supply, I wanted a rectangular piece of wood to attach to the box where the old circuit board was.  This would allow me to attach parts to the wood and not the metal.  I also wanted to use the CNC router to cut the wood just so I could use the router again.  I had to design my own DWG file.  The tool I used to design the wood piece was LibreCAD.  LibreCAD is free and runs on Linux.

The wood piece is a simple rectangle with four holes to attach it to the power supply.  I spent about 2 1/2 hours designing the piece and then cutting it with the CNC router.  It takes a lot of time to measure everything precisely and then design it in the CAD software.  It does not help that I have not used LibreCAD and have to try and retry everything many times.

All that being said, the results were perfect.  The nice thing is that I can re-cut as many of these as I want with the exact same specifications.  In fact, I did cut six more before I left just because I could.

After cutting the wood and mounting it in the power supply, I also installed the PowerSwitch tail in the power supply box.  When I turn the switch on for the power supply, the PST has power as well.  Cool!  Next, I need to figure out how to wire in my raspberry pi to power as well.

The fan that came with the power supply did not work so I replaced it with a different one from the parts rack at the Makerspace.  The fan says it requires 12v input but it will work down to 3v.  My raspberry pi has a 5v output so it does power the fan, albeit a bit slower than it could run.

Now that the enclosure is working a bit I started testing out the new circuit.  First, I wired up the A and B circuits.  Each circuit has two outputs and one input.  One of the outputs sends a signal through a 1k resistor and the other sends a signal through a 100k resistor (not at the same time).  The way it work is like this.  The program on the raspberry pi sends out a signal on circuit A's 1k section.  The input on circuit B looks for a signal.  Then, the pi turns off the first signal and sends another on circuit A's 100k section.  If circuit B does not see that signal, the pi shuts off the signal and tries the same tests sending on circuit B and listening on circuit A.

For whatever reason, this circuit design works perfectly.  The pi always detects a signal when it is sent over the part with the 1k resistor.  I never got any false readings.  I think the problem is solved.

Here is a link to the circuit schematic.  I made it in Digikey's free SchemeIt on-line tool.  By the way, I have tried a few of schematic designers.  Most of them are either not free or too complicated.  I just want to make simple schematics for electrical circuits.  Circuit Lab was nice but is no longer free.  I installed the Electric VLSI Design System on my Linux computer but it is too complex.  SchemeIt was pretty easy to use, and allowed me to easily create my schematic.  I can share the link on the internet and even save it to PDF if I want.  For now, I will stick with SchemeIt.

I also made some videos of the HESA in action that I will upload to YouTube and post a link to.

Another great day at the Makerspace.

Pitcher Holder "Fixed"

The pitcher holder piece that I 3D printed for the automated pet food dispenser does not fit correctly on to the PVC T.  The inside diameter of the pitcher piece is just a bit too small.

I used a drill press and various tools at the Milwaukee Makerspace to rough out a bit of the inside diameter of the part.  I tried different tools (see picture) starting with a little Dremel sander (not pictured), then a 1/4" drill bit, a bigger gear-looking bit, and finally, a wire brush.  The sander and wire brush both worked but are incredibly slow.  The drill bit did not work at all.  The gear thing was too coarse.  It kept gouging out parts of the plastic.

Eventually, I did shave off enough plastic to squeeze the holder onto the PVC.  Unfortunately, I shaved off enough plastic to get to the inlay and crack the piece.  You can see the crack in the picture of the piece.

I will see what Tim thinks but we will probably push on and try to finish assembly with what we have as a beta.  Then, I can re-measure everything and try to re-size and re-print the auger and pitcher holder to fit the PVC dimensions.

I think that will be after I get the HESA project done.