Tuesday, January 28, 2014

Avahi Server Works at Star

After my failed attempt to get the get the Raspberry Pi running Avahi working on the Star school network, I got some help.  I met up with Chip, our router and networking expert, at Star of Bethlehem to try again.

The first thing we did is changed the name of the device from exodus to acts because exodus was an old server name that the network still remembered.  It was causing problems.  Changing the host name is done in both the /etc/hosts and /etc/hostname files.

Next, we gave the device a fixed IP address by editing the /etc/interfaces/network file.  I had previously setup a fixed address and simply uncommented those lines and commented out the dhcp line.  Rebooted.  The new name and IP address were configured.

Chip went into the DNS program on the Windows 2008 server and cleaned some things up.  There were entries for some old servers that he deleted.  He also added acts as a server in the DNS.

Now that the device was setup properly, and the network issues were fixed, we moved acts to the server rack in the work room and fired it up.  It worked.  PTL!

The next step was to get the Avahi server working with the Cisco router.  Cisco has a web page where they explain how to do this.  We followed the four steps below.  Chip decided to use vlan id 10 on the Pi's IP address.

  1. Add the Avahi daemon and VLAN packages to the OS via the sudo apt-get install vlan avahi-daemon commands.
  2. Edit the Avahi configuration file and enable the reflector functionality in the Avahi Daemon.
    ubuntu@ubuntu:~$ sudo nano /etc/avahi/avahi-daemon.conf
  3. Within the configuration file, change the “enable-reflector” option to yes and make sure that no # symbol is before the line.
  4. Issue the sudo vconfig add eth0 10 command in order to add a VLAN:
We added the vlan id information to the network file. We then started configuring acts to work with the Cisco switch.  Chip did some stuff on the Cisco switch itself.  I'm not exactly sure what he did but it involved setting up some kind of "route reflector".

The Cisco page tells us to run avahi-browse command to see all apple devices on the network.  However, we had to execute
sudo apt-get install avahi-utils 
before this would work.  These instructions were not on the Cisco instruction page.

Finally, the vconfig command we executed at the command line did not stay after a reboot.  We added the following line to the rc.local file.
sudo vconfig add eth0 10
Chip tested the solution with the teacher who first reported the problem.  It works great.  Problem solved!

Monday, January 27, 2014

Wizards Staff is Done

My son, Dmitry, finished making the wizard staff that I made by connecting two three foot dowels.  He covered it with strips of grocery bag and then painted the strips brown.  A darker brown paint was used to paint runes onto the staff.

His hand is partially covering a leather strip that he wound onto the staff.  The leather is from his sister's old purse.

The top of the staff has a metal hanger bent to look like, well, I guess something that is on the top of a wizard's staff.  The director of the play he will be in wants to replace the wire with some kind of globe.

I kind of like the staff the way it is.  Nice job Dima!

Here is a link to the play he will be using the staff in: Once Upon a Mattress.

Sunday, January 19, 2014

Installing OpenSCAD

I wanted to document the process to install OpenSCAD on my Linux laptop.

Ideally, all I should have to do to install OpenSCAD is type
sudo apt-get install openscad
at the prompt.  However, when I did that, I got an error message that the libcgal8 part could not be found.  I found an internet page that explains how to installed libcgal8.  I tried the easy part of simply running
sudo apt-get install libcgal8
That did not work either.  It said something about missing files.

The web page above said to make sure that the multiverse repository is enabled.  Here is a page that talks about adding repositories to the sources.list file.  I edited the /etc/apt/sources.list file and added the last two lines shown below in green.
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu## team. Also, please note that software in universe WILL NOT receive any## review or updates from the Ubuntu security team.deb precise universedeb precise-updates universe## 19 Jan 2014.  Added multiverse lines.  ksb.deb precise multiversedeb precise-updates multiverse
Next, I executed
sudo apt-get update
A number of things were installed.  So, it must be looking at the multiverse repository now.  The next command to run was 
sudo apt-get install libcgal8
This time, it worked.  Just to keep things tidy, I ran 
sudo apt-get autoremove
Six programs were removed.  Finally, I executed
sudo apt-get install openscad
This worked as well.  

Phew!  That was too much work.  On a side note, I never would have been able to do this 10 years ago.  Linux and its documentation have really matured.  I wonder if I could have done all this through the GUI...

Here is the "hello world" drawing in open scad.  OpenSCAD works as well.  PTL!

I tried opening my dxf file using the command Pete Prodehl, self-proclaimed expert, shared with me 
linear_extrude(height = 10, center = true) import("./Things/ToolHolder.dxf");
but it did not work.  Well, at least it did not display anything.  I did not get any errors.  I'll have to make sure the dxf file is in the correct format and try again.  Progress is progress.

Saturday, January 18, 2014

Wobbly chess piece printing

I stopped off at the Makerspace this morning to pick up the Wobbly chess pieces I started printing yesternight.  Four of the pieces finished printing but the King, Queen, and two Bishops did not.

The spool of filament had fallen off the rack and the wood dowel slid out. I suppose that means that the filament was stuck on the spool and got pulled off the rack.  That's a lot of force pulling on the filament.

The Makerspace got the PLA filament for free from some company that makes filament. Maybe that sticky rolls is why they donated it. Actually, it's not that bad as long as I keep loosening the filament on the spool every few minutes. I tried loosening as much of the spool as I could before I left last night but I guess it was not enough to last the entire print.

Oh well. The description on Thingiverse said that printing all of the pieces is a challenge.  I'll have to print only a few pieces at a time.

Friday, January 17, 2014

Learning CAD and Trying to 3D Print

I made it back up to the Milwaukee Makerspace after two weeks.  I worked on projects at home last week.  Today, I wanted to do some 3D printing.  I started off trying to print a base for a raspberry pi.  The work kept getting messed up before the raft was finished.  I think the print bed needs to be resurfaced.

I gave up after an hour and started printing chess pieces for the wobbly chess set instead.  The print run will probably take over six hours to complete. Unfortunately, I could not stay at the space until 2am, so I left the machine printing.  I hope if completes.

While the printer was running, I decided to try making a very simple CAD drawing.  At the Makerspace, we have tool holders that are not ideal for the smaller screwdrivers we have in the electronics lab.  I thought I would make a simple rectangle piece that was solid except for holes for the screwdrivers.

I created the drawing in LibreCad and saved it as a DXF file.  Next, I tried to figure out how to convert a DXF file to STL.  Google Sketchup will supposedly do the conversion but only if you have the Pro version.

I read that Blender will do it so I installed that on my Linux laptop.  However, Blender would not open my DXF file.

That's pretty much as far as I got tonight.  Not very exciting but being a Maker takes a lot of patience and persistence.

Sunday, January 12, 2014

Adjusted Detection Function in HESA

I have gotten a couple of false positives on the water detection circuit on my Home Environmental Sensor Array.  It happens about once a week for no reason.  Its not because the sump pump is running and splashing water up to the plug.

Rather than scientifically figure out what is happening, I adjusted the detection function.  It now has to detect water for 500 milliseconds (5 seconds) during the detection cycle.  The milliseconds do not have to be consecutive but the count resets in each new cycle.  A detection cycle lasts 1000 milliseconds (10 seconds).  So, water has to be detected for half of the detection cycle.

That should stop false positives.  The downside is that 3v of electricity will be in the water for at least five seconds until the program shuts off the power.

Here is the code for the detection circuit.

    # Look for input for up to 10 seconds
    # Water must be detected for five seconds for this function to return a positive result
    if hesaDebug: print ("Looking for a signal on pin " + str(pinIn))
    circuitTimer = 0 # Tracks how long the program looks for a signal
    highCount = 0    # Tracks positive results
    while (circuitTimer < 1000): # 100 = 1 second
        if GPIO.input(pinIn) == GPIO.HIGH:
            highCount += 1
            if hesaDebug: print ("Signal found.  highCount = " + str(highCount))
            if highCount > 500: 
retResult = 1
circuitTimer = 1000

            circuitTimer += 1

        time.sleep(0.01) # 10 milliseconds

We tested the code by putting the test leads into a cup of water from the faucet.  As long as it was in the water, the highCount increased.  If we pulled the leads out of the water before five seconds elapsed, the HESA did not report water.  It did detect water if left in the cup for five seconds.

Saturday, January 11, 2014

RPi Avahi Server Works at My House

In my post from this morning, I documented the frustrating and ultimately fruitless work to get a Raspberry Pi device running Avahi (henceforth referred to as "exodus") working on the network, at my kid's school, Star of Bethlehem.  I had to give up because the Star network stopped working for my laptop, and I was hungry, and I had to get a haircut before going to Jacob's basketball game.

On the way out of the school office, I noticed that the power cord for the wireless access point in the office had come unplugged.  That could be why my laptop could not get to the network over wireless.  It may account for the problems I had in the last few minutes at Star.  However, it does not explain why I could not connect to the pi at exodus.local at Star.

Enough of the painful reminiscing.

This evening, I brought exodus home and hooked it up to my tiny area network (TAN).  I reinstalled avahi and started the daemon.  I was immediately able to ping exodus.local as well as ssh to exodus at that hostname.  Everything works as it should.  I'm not sure if I am happy about that or not.  I must admit that part of me is frustrated that it did not just work like this at Star.  It really should be this easy.

Just to see what would happen, I changed the host name in /etc/hostnames and /etc/host to cappucino and rebooted exodus.  I was immediately able to ping cappucino.local with absolutely no issues.  I also used ssh to connect to cappucino.local.  Again, no problems.

Changed the host name back to exodus and rebooted.  Had no problems pinging exodus.local.  No problems using ssh either.

I guess I'll take exodus back to Star next week and try again.

First Attempt to Install Avahi Server at Star

I brought the Raspberry Pi with Avahi to Star this morning and installed it on the school's network.  I connected it to port 4 on the middle switch.  It fired right up.

Before I came, I changed the network settings to use DHCP.  That way, I could be sure it would work on the network.

Also, I created a user account on the Pi named startech.  It has the usual Star administrator password.  The user has the ability to execute sudo commands as well.

After the pi booted up, I was able to ping it at star-avahi.local.  That is the device's hostname.

I also used ssh to successfully log in to star-avahi.local from my laptop.

PTL.  Everything works so far.

Now, the fun starts and by fun, I mean frustration.

After I got here, Bob gave me to use as a permanent IP address.  I changed the /etc/network/interfaces file to use a static ip address with that number.  I could not ping the device or see it on the network after that.

I took the Pi into the office so I could login to it directly.  I changed the network settings to comment out the fixed IP lines for network and broadcast and rebooted.  Then, I could see the device on the network using its IP address but not with the host name of star-avahi.local.  Using DHCP to get an IP address did not help with the hostname either.  I don't know why avahi is not working now that I am in the office.

Bob and I talked and agreed to use "exodus" as the hostname.  I modified the /etc/hostname file to use exodus.  Then, I tried editing the host file.  Nano never opened up.  I had to use the three finger salute and reboot the device.  I was able to change the host file after that.  Now, the device is named "exodus".

Getting back to avahi, I gave the device a fixed IP address.  The interfaces file now has lines like this:
iface eth0 inet static

Rebooted.  Pinging works.  Pinging exodus.local times out.  The hostname is not found.

Nmap sees but does not return a hostname.

Executed sudo /etc/init.d/avahi-daemon restart.  Still can't ping using the exodus.local host name.

I moved the pi back into the workroom and plugged it in to the network.  I could not ping either exodus.local nor  Nmap does not see the .39 address on the network.

Moved the pi back to the office.  I could then ping with the local ip address only.  Not with the host name.  Nmap can see the .39 address as well.

So, when using a fixed IP address, I can see the pi when it is plugged in to a network port in the office but not in the workroom.  The pi was plugged into switch port four on the middle switch.

I moved the pi back to the workroom and plugged it in to the same port that the PC in the office was using.  Now, I can ping the IP address but I still can't ping the hostname.  Nmap sees the .39 address.

So, something about port 4 on the middle switch does not let me ping the pi when it has a fixed IP address.

Next, I used ssh to connect to the pi in the workroom.  I changed the network settings to use DHCP instead of a fixed IP address and rebooted.  Nmap did not see the pi on the network.  I could not determine its IP address.

Brought the device back to the office using the same network port on the switch that I used while in the workroom.  It reported an ip address of  That is why Nmap did not see it before.  I was looking for IP addresses on the .96 subnet.  Ran Nmap on the .97 subnet and I do see IP address .14 but it does not have a hostname.  Still can not ping the host name.  I can ping the IP address.

Brought the device back to the workroom using the switch port that is normally used in the office.  I was able to ping  Still can not ping the host name.  Nmap does see the device at but it has no host name.

Next, I moved the device to the middle switch, port 4.  The pi is still setup for DHCP.  Cycled power.  Nmap shows a new device at  One time it gave a hostname for that IP of Jericho.  One time as Genesis.  If I ping, there is a response from both and on IP

Something is definitely squirrelly with port 4 on the middle switch.  It must be setup specifically for some host or IP address.

Plugged the pi into port 9 on the top switch.  It got an IP address of  Still can't  ping exodus.local.  Was able to ssh using the ip address.

I changed the host name in the hostname and hosts files back to star-avahi and rebooted the pi.  Can't ping or ssh to the star-avahi.local host name.

Changed the host name in the hostname and hosts files back to exodus and rebooted.  The IP address when back to  Tried stopping and starting the avahi service with service avahi-daemon stop and then start.  That did not help.

Used sudo apt-get purge to uninstall Avahi.  Then, ran sudo apt-get update.  After that the pi started reacting very sluggishly.  I had to cycle power.  I still could not see the pi after that.  nmap could not see any network devices on the 96 nor 97 subnet.  Its like the network went down or my laptop lost its IP address.  I cycled power on the devices in the cabinet in the workroom but that did not help.  My laptop could not connect to the wireless network.

I plugged it in to a hard line and it got on the network.  Not sure what happened.

That's it for one day.

Friday, January 10, 2014

Started Setting up Raspberry Pi for Star

The Raspberry Pi for the Avahi / Bonjour server at Star arrived today.  I started setting it up.

I took everything out of the box and put the RPi in its acrylic case.  I bought an SD card with the RPi that had NOOBS v1.2.1 pre-installed.  After inserting the card and powering up the Pi, the NOOBS software started.  I picked the Raspbian installation and sat back while it did the install.  It took about twenty minutes.

When the Pi started, it ran the first-time configuration program.  I did the following:

  • Changed the pi user password
  • Picked the english US locale en_US.UTF-8.  For some dumb reason, you cannot uncheck the UK locale.  You have to use both US and UK.
I did not need to expand the file system because NOOBS did that already.

Next, I ran sudo upgrade and sudo update.  There was nothing to upgrade but it did perform some updates.

Changed the hostname to star-avahi.  I had to edit the /etc/hostname and /etc/hosts file with the hostname.  I found out that you can't use an underscore in the host name.

I asked Bob for what user name and password he thinks should be setup on the Pi.

IP Address
The /etc/network/interfaces file to have a static ip address instead of using DHCP.  I commented out the dhcp line and added these lines.

iface eth0 inet static

When I get a permanent IP address for the Avahi device, I can change the settings.

Finally, I installed the Avahi client for Ubuntu.  Full instructions are here.  I was able to ping the RPi using star-avahi.local.  So, Avahi works.

Next: install the Pi on the Star network.

Wednesday, January 8, 2014

Parts ordered for Avahi server

My kids' school needs a Bonjour / Avahi server so one of the teacher's Ipad will work on the school's wireless network. I took on the task of setting up an Avahi server and on a raspberry pi.

Yestoday, I ordered the RPi with a pre-loaded SD card and a clear plastic case from Element 14. The SD card has NOOBS installed on it. That should make setting up the RPi easier. At least I don't have to download the latest distribution.

The stuff shipped yesterday. So, I should be able to start working on it next week.

Sunday, January 5, 2014

Arduino is Broken

I'm pretty sure my Arduino Uno is broken.  When I plug it in using the USB cable, the green power light turns on and the L light near pin 13 turns yellow.  They are the only lights that come on.  They do not blink.  They do not turn off.

Also, the Arduino IDE software on my Ubuntu 12.04 does not see the Arduino when I plug in the USB cable.  When I click on Tools from the IDE menu, the Serial Port entry is greyed out.  The same thing is true when I connect the Arduino to my Windows computer.  The IDE software in Windows has the Serial Port entry greyed out as well.

I tried resetting the Arduino by pressing the reset button.  Nothing happens.  I also hold down the reset button while plugging in power.  Again, nothing happens.

I did some research on the internet.  I think the problem is that either

  1. the AT chip is bad or
  2. the bootloader software on the chip got erased or corrupted and needs to be reloaded.
I found a page that talks about how to update the firmware on the Arduino.  Not sure if this will work but I'll have to give it a shot.

Saturday, January 4, 2014

Updating the O/S on the BeagleBone Black

A few days ago, I worked on my BeagleBone Black (BBB) but I did not make a post until now.

I bought a 16gb micro-SD card on the way home from work.  Now, I can update the Angstrom distribution on the BBB.  First, I downloaded the "Angstrom Distribution for BeagleBone Black - 2GB eMMC" dated 2013-09-04.

Next, I downloaded and installed 7-Zip.  I got the 64-bit version for Windows.  I used 7-Zip to unzip the img file.  The Win32DiskImager tool was used to put the image on the 16gb micro-SD card.  I had to use the SD adapter that the micro-SD card came with.  At first, I tried an older SD adapter and the computer kept saying that the card was read-only.  That was strange.

(My AV software said that a trojan horse program was also in the 7-zip install package.  It deleted the virus and 7-zip worked just fine.  More weirdness.)

After putting the image on the micro-SD card, I inserted it into the BBB, and applied power from an external 5v power supply while holding down the boot button.  The activity lights started blinking like they normally do.  I was not sure if it was working or not so I left it alone for about an hour.  I expected to come back and see all four activity lights on steady.  They were all still flashing away.  

So, either
a) the flash did not work
b) the flash was still going after an hour
c) the flash worked but the four lights did not stay on steady.

When I have some time, I will check the micro-SD card on a PC to see what version of the distribution is on it.

Maybe I need to format the micro-SD card first, then copy the distribution to it, then flash the BBB.  This is a lower priority project for me right now so I might not get to it until after I get a few other things done.

12v Power with Arduino Test

Tonight I tried to get my Arduino to work stand-alone with a 12v, 2A external power supply.  I hooked the Arduino up to my servo motor, then plugged it in to power.  It worked as I expected it to.  The Arduino made the motor spin one direction for 1 second, then the other direction for 2 seconds.  It stopped after one minute.

Next, I wanted to connect the servo to a fixture I had 3D printed for the automated dog food dispenser.  It
took me several minutes to get the servo connected to the fixture.  The Arduino was plugged in to the 12v power the whole time.  When I was ready to test the program again, I smelled a slight electrical burning.  I sniffed the servo and the Arduino but neither had a strong burning smell.  The main chip on the Arduino was a bit hot so I unplugged it from the power.

Then, I connected the servo to the Arduino and plugged in the 12v power supply.  The servo did not turn at all and one of the lights on the Arduino that normally turns on did not.

I plugged in the 9v power supply to the Arduino and the servo spun but only in one direction.  Also, it never stopped spinning.  I pulled the wire from the signal pin on the servo and it still kept spinning.  Pushing the reset button on the Arduino also does nothing.

Something is wrong, but I am not sure exactly what.  Maybe I burned out the Arduino chip.  Maybe I just wiped out the sketch from the Arduino.  I have to do more experimenting some other day.

BTW, according to this official Arduino page, the power input range is recommended to be from 7-12v but will handle from 6-20v.  So, my 12v power supply should not have burned it out.

Friday, January 3, 2014

Controlling a Servo with an Arduino

Tonight at the Milwaukee Makerspace, I worked on getting my Arduino Uno to control a servo motor.  I need the servo to control the auger on my automated dog food dispenser.

I got the sketch working to control the servo over Thanksgiving weekend.  However, it only worked when the Arduino was connected to the computer over a USB cable.  When I powered it with a USB cable from a wall wart, the servo did not spin correctly.

Tonight, I did some more testing.  First, I changed the code slightly so the servo runs for one minute and shuts off.  It worked great when connected to a computer.

Next, I connect a 9v power supply to the Arduino.  It powered up but the servo never spun.  One website said that this is because the Arduino is getting interference on the RX port.  The fix is to connect the RX port to ground via a 10k resistor.  I tried that by connecting the digital RX port to ground with a resistor but it made no difference.

I used a multimeter to see how many volts the Arduino was putting out when powered by the computer and when powered by the external power supply.  On the computer, the 5v port output 5 volts.  On the external power supply, the 5v port output 4.85 volts.  I can't believe that makes a difference.

Next, I tried powering the servo from the 3.3v port instead of the 5v port when powered by the computer.  The servo still worked but would only spin in one direction.

I think I will try a 12 volt power supply next to see if that helps.

Wednesday, January 1, 2014

Learning about the BeagleBone Black (BBB)

I spent part of my day off learning about the BeagleBone Black (BBB).  I want to replace the Raspberry Pi (RPi) in my Home Environmental Sensor Array with a BBB.  The BBB is a Linux computer just like the RPi but the BBB has both digital and analog inputs and more of them.

Here is some general information I learned.  The BBB is using the sh shell.  The RPi uses the bash shell.  The BBB comes with a version of Angstrom Linux on the internal eMMC card.

I needed a way to power the BBB without the USB connected to a PC.  I had an old Linksys phone device that has a power supply that converts 120v to 5v, 2A.  It will power the BBB.  

Previously, I created an account on the BBB for kbecker with my standard password.  I plugged the BBB in to an ethernet cable and could ssh into it from my Linux laptop.  I tried using FileZilla to connect to the BBB but it would not login.  FTP is probably not enabled for anonymous access or something.

I don't really want to make any changes to the BBB until I upgrade the O/S and put Ubuntu Linux on a bootable mini-SD card.  I don't have a mini-SD card right now.  That is the next thing to do.