Friday, December 26, 2014

Laser Cutter Fun 2

Owls
Student Graduation Cap Topper
Millersville University
Jägermeister

Olaf from Frozen

Rutgers Scarlet Knight


Monday, December 8, 2014

Raspberry Pi Picture Frame Post 14 Final



At this point I believe the project is complete minus one part. Finishing the frame but that is going to wait until the final user chooses how they want it finished. Major software changes since last time where
  • When pictures are re-sized they are moved to a new folder then the originals get deleted. 
  • Frame can now be programmed to turn the screen on or off at given times because it knows if the frame is on or not. 
  • Divided some of the scripts up into separate scripts for easier troubleshooting 
  • Made the button to turn off the screen have 3 functions (no limit to number of functions)
    • 1 turn screen off. (quick press)
    • 2 preform a sync with google (press until blue led turn off about 3 seconds)
    • 3 power off the pi (press until pi starts shutting down. about 5 seconds)
Overall I am really happy with how the project came out. All of the individual pieces have come together to make a really neat picture frame that looks exceptionally nice. Here is a copy of all of my scripts used and Here is the stuff for the weather,If you have any questions all you have to do is ask.

       
Mount holding monitor in framePower button with Blue LED
Back View

Thursday, December 4, 2014

Raspberry Pi Picture Frame Post 13 Update

The picture frame has come a long way since the last post. I now have the wooden frame for it built and almost done but we will come back to that in a minute. Since the last update I have completely remade some of the electronics. The only reason I did this is because I fried 2 different wireless receivers for my button inputs and since I wanted to add a few more items I decided to basically start from scratch. Beyond the remote control for input I added the following items


  • On board power switch that turns the monitor on and off
  • The switch has a LED in it which will tell you the status of the screen
  • Input for monitoring status of screen

Above you can see my old setup (on the bottom) and my new setup (on the top). Yes it is probably 3-4 times bigger but you never know what you may want to add to the project down the line so I left it big. It helps that I have excess space so I can easily leave it big. On my old setup I had the resistor divider n the back of the wireless receiver. This time I have it on the perf board. To add the power button I had a few options. 
  1. Wire the button in parallel with the original monitor button
  2. Wire the button in parallel with the remote button that tells the pi to turn the screen on or off
  3. Wire the button to a new input
I liked the hardware approach better than the software approach so that took off one option. To keep the number of wires coming off my new board to the bare minimum I decided to wire the switch in parallel with the wireless receiver. The power button I used is from adafruit and can be found here

Instead of having 4 wires coming back from the switch (LED +, LED -, Switch Common, Switch Normally Open) I only have 3 (5v, Switch Nomally Open, LED -) I have done me best to make each different part removable in case something breaks it should be pretty easy to replace. Since everyone likes schematics you can see mine below. 

You will notice that I also have a transistor setup to switch the LED on instead of relying on the PI to supply enough current. I also wanted it to run off 5 volts instead of the 3.3 the pi will put out. There is also a transistor right by the monitor button. At this point I have not done any additional coding but all of the hardware is now done.

Now on to the actual wooden Frame. Due to the thickness of the monitor I new the frame was going to be thick and it doesn't bother me one bit.


I got the wood from my local Lowes. Each side is made up of a 1/2 x 3 and 1/4 x 1.5 glued together.


I glued them together mitered the corners and glued it all together to make a nice frame. Then I cut it down to a little over the thickness of the frame so it wouldn't be to excessively thick. I still need to add a hole for the button and make a notch bottom center for the power cord to come out in case it gets hung on a wall. 


Sunday, October 26, 2014

Laser Cutter Fun

A few weeks ago I was asked to help with a presentation on 3D printing. I was asked if there was anything we could print as examples that we could give out to each participant. We wanted something related to ISU but I couldn't find anything so I decided to make a sycamore leaf with ISU in it. http://www.thingiverse.com/thing:494399 Design was it was a very simple process. I imported a sycamore leaf into inventor and then just traced it. Added some text and a hole at the top and it was done. Now when talking to people who have no idea what 3D printing is they can have a hard time understanding how the machine works and all of the layers. So I decided I should laser cut out a few layers so I could show them layer by layer how it works.
After cutting these things out I realized that they would make nice decorations so I cut out a bunch of them out and started giving them to people. Personally I like the one in the middle the best. Not only does the middle one look nice, so does the pieces that cut out and glued to a backer board.
After making a bunch of these I started thinking about what other things I could laser cut out. Came up with a fee ideas for presents so this will be updated after they have been distributed.

Sunday, August 31, 2014

Rigidbot Modifications

After having my 3D printer for a while and doing long prints I got tired of having the printer running in my room. Sure it was nice when it was time to check on my prints, but sleeping with the thing running was not ideal. So the first thing I did was add a raspberry pi running OctoPrint. If you have not heard of OctoPrint it adds a web interface to control your printer. It even allows you to add a webcam so you can easily do time lapses of your prints or see how the print is coming from anywhere with internet. (That is on my list to add) This interface allowed me to move my printer to another room in my house.

Now That I add the raspberry pi I now have to plug my printer into the power brick, plug the raspberry pi into the printer, and the raspberry pi into the wall for power. To me that was a little ridiculous so I decided I wanted to mount everything to the printer so it was one plug and done. This was going to be a project for farther down the road except one day the printer would not start. It turned out that the plug from the power brick to the printer was not the best connection in the world. I was not a fan of that plug to begin with but figured don't fix what ain't broken. Well once the plug stopped working I figured it was time to replace it and mount everything to the printer. I also wanted to make a stand so the printer would be at table height. That part is not done yet but the important part is the printer is printing again.

Now I decided that the raspberry pi, power supply and control board would all mount to the dame tray. That way if I needed to work on something I could take it all out in one piece. I measured the distance between the bars and how long the power supply was and made the tray below.
Due to my need for precision after taking a metal working class at my undergrad (this has gotten me into trouble before) The metal tray was a hair tight. Should have made it a 1/16th smaller but it still fits and that is what is important in my book.
Now I had a general idea of how the electronics where going to get layed out before I built the tray but here was the plan once the tray was made.
Now it was time to start attaching things to the tray. I decided to use the orignal box for the controller so that it would be protected and I would know what plug was what. I needed to insulate the raspberry pi from the tray as well as the dc-dc voltage converted (this way I would not need to have a second plug for the raspberry pi). The power supply would be held in with a metal strap. 
I thought about 3D printing a raspberry pi case and something for the power converter but whey spend the hours printing that when in under 10 minutes I can draw up a 2D spacer and laser cut it out. Now in the above picture you can see the electrical work already done. Originally I was going to have to have 2 sets of wires connecting the power supply to the control board. You can see the second plug in this picture. After I had wired the wires to the power supply I thought about it and did a quick Google and determined that the 10 gauge wire I was using and the power connectors would be able to hand the current with just one plug so I only soldered 1 to the control board. I will remove the other plug later when I move the 120 vac plug from the back of the power supply to the printer itself. Now we all know how big of a pain it is to wire things together when space is tight. So to make my life easier my tray just pivots on 2 of the screws holding it in so it is easy to plug everything in and work on anything if needed. 

After I got everything all wired in all I had to do was rotate the panel back into the bottom of the printer and put the other 2 screws in. 

That's it for stage 1. It will probably be a bit before stage 2. Which will include moving the 120 vac plug, painting everything, replacing the USB cord with a 6 inch one so I don't have a cable coiled, and finishing the stand. Currently it is a little wobbly.


Wednesday, August 20, 2014

Raspberry Pi Picture Frame Post 12 Image Resizing

As I said in my last update I said that I wanted to resize images to save space on the pi. To do this I am going to use imagemagick. You can install it using the code below.
sudo apt-get update
sudo apt-get install imagemagick
If I remember correctly I mentioned earlier that capitalization is extremely important with Linux. This includes file extensions. If you use my scripts the slide show will only show .JPG files not .jpg. So to fix that we need to make sure all of the pictures have .JPG as there extension. This is done with one simple line of code.
rename 's/\.jpg$/\.JPG/' *.jpg
Now if you want an explanation of what everything in the code means go here. I tried to explain it but in the end that's where I got the help from and that website does a much better job. So I gave up on explaining. Now all of our files have the same .JPG extension. Next we will resize the pictures. If you want to just do one the command is convert input.JPG-resize 1280x1024 output.JPG. Now in that case we can change the file name output and the extension. However when we do a batch process it does not work nicely. Below is the batch convert code. 
for file in *.JPG; do convert $file -resize 1280x1024\> $file; done;
Now lets break that down. for file in *.JPG; What this means is for each file found with the .JPG extension we will do the following. The $file allows the command to use the file name from the for section. The done at the end says that we are done looping commands, go to next file. Just search batch convert imagemagick if you want more information. The \> says to only re size bigger images. This way we don't reprocess each image every night. Now I am going to add this to the grive.sh script. What I want it to do is check for changes (aka new pictures) and download if there are, then convert the files, then sync the new files to the web. 

Monday, August 18, 2014

Raspberry Pi Picture Frame Post 11 Progress Update

Now that I am finally back in Indiana I have got the picture frame setup and it is working like a charm. That is once I got it connected to the internet again. Today I gave out the information so that my siblings could start uploading pictures to the frame so that I can give it a good test. just over 4 months till Christmas when I need this thing working perfectly.

Things I have changed since my last post.

  • Added picture re sizing. I was putting the files as the came off my camera directly onto the picture frame. These files were about 3mb. I setup the picture frame to resize the images down to the make resolution of the screen. That way the files are smaller and more will fit on the memory card. They are about 1/5th the size they were originally. (will write up how I did this later once I figure out how I did it.
  • Moved picture locations. Instead of having the pictures in the main google drive folder. I moved them to a folder called pictures. This allowed me to share that folder with edit capabilities with other family members so that they to could add pictures without me having to give them my username and password. 
Things to be done
  • Build the nice wooden frame. Luckily I have access to a nice wood shop out here which will make my life much easier.
  • Add a external light so you can tell when the screen power is on and off. Now you may be wondering why I want to do that since the screen will be showing pictures when it is on. Simple. When you use the remote to turn the screen on you don't know if its powering on unless you wait since there is about a 5 second delay for power on
  • Add a gpio input for screen power. This way we can schedule events to turn the screen on and off. Without this if the screen is already off and the off event comes it will just turn the on which is the opposite of what we want. 
  • Change weather screen 2. I said this in a previous post but I plan on changing the second weather screen to show the weather in 4 different locations.

Sign for Mark

At the end of last semester there was a student who wanted to make something for the Metal Lab Professor. The Professor who gave me the name Betz Mobile Engineering. You could say I am a sucker for helping students. Especially when I know what the extra curricular project is for. For some people this may sound weird buy I am here for the students. I do not have any needs to move up the food chain, well at least currently and I do not think I will want to in the future. I enjoy teaching and working with students. So when a student told me he wanted to make something for this professor I was all about it. After all sometimes us teachers do not get enough recognition. So I asked him what he wanted to do. The problem was he had no idea. I suggested that we do something with the laser engraver. Now being the Unmanned Systems professor so of you may be thinking, Why do you have any idea how to use the laser engraver? The answer is simple I wanted to build a helicopter and I designed it to be laser cut out of 1/8 in plywood so the laser engraver could cut it out. Since then I have done a few more projects. See my website to see the projects.

So back to the project for the other professor. I told the student to go look for images that he would like to etch. Ideally a raster image so we could scale it without any issues. The next day he told me he could not find one he liked. This surprised me a little bit with how many images are on the internet. First thought was he did not try very hard so I did my own google search and guess what. I had the same problem. I found one I liked on shutterstock.com but I did not like how things don't line up properly. Yes I know that was done on purpose but I still do not like it. Pl
So what do I do. I use that image as a inspiration to create my own. Now up to this point I have used some of Adobe's programs for photo editing and document layout but I have not used Illustrator to do that much. Sure creating boxes and lines is easy to do. However recreating the above image had some difficulties to it. I learned how to cut the shapes into different sections and combine them to make one shape. Did I do this the most efficient and proper way, I guarantee you I did not however I got the job done was extremely happy with the finished product. I focused mainly on the lathe. The guy in the background I did not want to do without. Plus I already have a line art guy. He is kinda my symbol. A guy plugging things in. So when I was down doing the lathe I add the guy that I drew before in the background and get what you see below. 
Now you are probably thinking. You did all this for a student? The answer is YES!!!! Without the students I would not have a job and without students caring about the professors and what they are learning my job would be really boring. Students who are excited and want to learn is why I am a teacher. So if a student wants to show there respect for another professor by making them a little thank you gift you better believe that I am going to do everything I can to help them. 

Now that we had the image we wanted to use it was time to prep the wood and etch. I showed the student how to safely use the tools necessary, some where new to him like the laser engraver and some where just refreshers like the table saw. He got the wood planed down to proper thickness and cut down to size. All we had to do was the etch the image and guess how is walking by and decides to stop in and see what and how we are doing.  You guessed it the metal lab professor, luckily we did not have the image up and the student quickly said he was making something for his mother. After the other professor left we engraved it and gave it a light sanding. I am very happy with the final product.



Tuesday, May 20, 2014

Raspberry Pi Picture Frame Post 10 Remote and Video Demonstration

After doing some testing I was having problems with the remote working properly, and it still doesnt work quite as well as I want it to but that is what testing is for. Part of my problem was that my IOcheck.sh script had some errors in it. So I fixed those. Another issue I had was that my showweather.sh scripts were no executable. That was an easy fix, the code is below.
{{
sudo chmod 775 /home/pi/drive/scripts/showweather.sh
sudo chmod 775 /home/pi/drive/scripts/showweather1.sh
}}
Another item I did was each time a button is pressed I kill fbi first before trying to start the next one. {{sudo kill $(pgrep fbi)}} is the code to do that. That should go into IOcheck.sh. I also added a while loop to the if statements for each button so that it wont constantly try to reopen the fbi while you hold the button down. It wont check for input until you release the button now.The code is below.
{{
while ["$( cat /sys/class/gpio/gpio17/value)" == '1' ]
  do
  sleep.1
  done

}}

Time for the first video of my picture frame working. Now as you can see in the video there are still some problems. Some of which I have no clue how to fix. First problem is the my photo slideshow takes a bit to start and I believe this is due to the size of the pictures. I am trying to resize the pictures down to 1280x1024 which is the resolution of my screen. I am currently using the pi to do the processing. Now we all know that the pi is not the most powerful device so depending on how many pictures you add it may take a while for this to process. If this works and helps I will add it to my morning sync. This way everyday new files will be downloaded, then resize, then the device will restart. The bigger problem than I have is the command line text you see flash on screen when switching between slideshow and weather.I have no clue how to fix this problem. I would bet there is a way but I do no know what it is so if you have any ideas leave a comment below.


I think I am going to change my weather button c to show the current weather for multiple locations instead of just one. Now it wont show a 5 day but the weather for towns where the whole family lives.

Wednesday, May 14, 2014

Raspberry Pi Picture Frame Post 9 Remote Setup

Remote Setup

Now I have already talked about setting the remote setup but we haven't gotten it completely setup. So we talked about how to get the pi to setup the individual pins as input or output. From my scripts folder the setup file is gpiosetup.sh. Currently I have 4 inputs and 1 output. I am probably going to add another input so that the pi can tell if the monitor is on or off. This way you can program the pi to turn the picture frame on every morning at 8 and off at 4 or whatever you like. While we can currently do that the pi doesn't know the state of the monitor so all we can tell it to do is toggle the display so if you use the remote to turn it off then at the scheduled time it would actually turn the monitor back on. Now my IOcheck.sh script is something that needs to be continually running. What I decided is but A will start the slideshow. Button B will show weather. Button C will show weather1 and button D will turn the display off/on. Basically we are constantly checking to see if a pin is high and if it is we run a script based on which button is pressed.

Now we need to run this script at startup as well. I am not sure why but Ted Hale doesnt put this in the same place as the slideshow start location. He puts at the end of /etc/rc.local. To edit that file we use {{sudo nano /etc/rc.local}} The line we want to add is {{/home/pi/drive/scripts/IOcheck.sh &}} and we want to add the before the exit 0 line. For those of you who are paying attention you may be wondering why do we have the & sign. What that sign does is tell the pi to run that script in the background. Otherwise we would never get anywhere because the pi would wait for that script to end and it never would.

Now at this point I believe that the picture frame is all ready to go. Testing is going to take a while which is always the fun part. Now I still have the frame to build but that can and will wait until I get some testing done. Some how my frame is going to have to let air flow because the screen generates a good bit of heat. I also want to make a good cheat cheat sheet of what does what and what goes where. Luckily most of that information is in these blog posts already. Just need to  bring them all into a simple file.

Tuesday, May 13, 2014

Raspberry Pi Picture Frame Post 8 Event Scheduler

Problems

Now for those of you who have been following along I have been doing some testing and found out that there is a slight problem with what I was doing. To make my life easier I have been keeping all of my scripts located in my google drive folder that syncs. This way I can edit them on my computer instead of having to do it via a command prompt. For the most part I still do edit them in the command prompt but it gives me options and I like options. It also means that for those of you who wants to replicate what I have done all of the files you download will always be up to date with what is on my device since I have just shared those folders with you. Now the flaw. Originally I created a user named slideshow which was the one who automatically logged on. Well do to the fact that my google drive sync folder is located in the pi user's folder the slideshow user needed special access which I do not know how to do. It keeps asking me for the su password or the password for slideshow which I did not have one setup for. So after not being able to figure out what the problem was I decided to change the auto login from user slideshow to user pi. I also had to add to the pi boot file the script to run the slideshow right away. {{sudo nano ~slidespihow/.bashrc}} add {{/home/pi/drive/scripts/slideshow.sh}} to the end of that file. Now when I reboot the slide show starts up right away.

Event Scheduler

Built into the pi os is an application called cron. this is an event scheduler. It is actually really easy to use. To open it the command is {{crontab -e}}. This will bring up a text file where you can create your tasks and when they will run. there are 6 parameters that we need to file in and they are {{m h  dom mon dow   command}}
  • m =what minute of the hour do you want
  • h = what hour of the day
  • dom = day of month
  • mon = month
  • dow = day of week
Somewhere along the line I read that fbi will fill the ram up or something along those lines and cause the pi to crash but it takes a rather long time to do that. Simplest solution to this problem is to restart the pi once a day. I also what grive to check for changes once a day so I made a script that will check google for changes, update what needs to be done and the reboot the picture frame so that the memory will clear and the new pictures will be displayed. That file is called grive.sh in my scripts folder. I randomly picked 1 am because this is going to be a present for my mom and rarely will she be up at that point so it will not bother anything. here is the line to make that happen {{0 1 * * * sh /home/pi/drive/scripts/grive.sh}} Now you may be wondering why *. Cron only runs the command if all of the place holders are true. so for my task it will run at minute 0 hour 1 of every day of every month of every day of the week. Now for my weather I am going to have that update every half hour. {{0,30 * * * * sh /home/pi/drive/scripts/weather.sh}} You see how I have 0,30. What that is going to do is at 0 minutes and 30 minutes of each hour of each day of each month of each day of the week run that command. you can do the same thing with each other holder. I also belive you can do ranges like 2-9, but don't quote me on that.

This project is really starting to come together now. Only a few things left to go.

Monday, May 12, 2014

Raspberry Pi Picture Frame Post 7 Slide Show and Weather Continued

Starting Slide Shows

It is time to start finishing up the different parts. Remember we are going to be using fbi to display the images. if you type in {{fbi}} into the terminal and hit enter it will show you all of the options for fbi. Now your preferences and mine are going to be different so I suggest that you read through what is available and choose the ones that you like. Before I get to my preferences if you are trying to start fbi from ssh you are going to have to include an extra setting so it know to use the monitor as the display instead of trying to show you them in the ssh window which just spits out an error. Now the code. I suggest you make an script for this line so if you want to change settings you can change the script instead of having to go modify boot files. If you download my files one of the files is to start the slideshow. {{fbi -noverbose -a  -u -t 10 /home/pi/drive/*.JPG}} Lets go through this piece by piece.
  • fbi = is the program we want to run
  • -noverbose = tells the program not to show the file names
  • -a = tells the program to auto zoom the pictures
  • -u = tells the program to pic random pictures
  • -t 10 = tell the program that we want 10 seconds on each picture
  • /home/pi/drive/*.JPG = /home/pi/drive/ is the directory that the pictures are in. *.JPG says we want all the pictures with .JPG file extension. Remember that linux is picky about capitalization so it will not show .jpg files. 
  • if you want to be able to start from ssh you must add -T 1
  • If you want to show multiple file types you should add this at the end of the above /home/pi/drive/*.XXX (xxx= what ever file format you want) make sure you give the directory location again.
  • You can also specify specific files if you prefer by replacing the * with the file name
Now you should be able to get a slide show started. I am not 100% sure if this is necessary but other people have included this on there guides so I will to. We need to make the script file executable. {{  sudo chmod 775 /home/pi/drive/scripts/slideshow.sh}} make sure you put file path correct. That is where mine is.

That last thing to do is have the slideshow start when we boot the device. To do that we edit the login script for the user, in my case slideshow. {{sudo nano ~slideshow/.bashrc}} You just need to add a line to the end of this file {{/home/pi/drive/scripts/slideshow.sh}}. So now every time you turn the pi on it will automatically start a slideshow using the pictures based on the information in the scripts. 

Weather Setup

 Most of the code for this section came from the kindle weather display. I had to make modifications because I wanted it to fill the screen instead of showing something designed for the kindle screen. 

Obviously the left picture is what other people have designed for the kindle and the right picture is what I changed it to so that it would use the monitor space a little better. Since I plan on having weather data for 2 different location based on what button you press I will be adding the location to this somewhere. Have not figured out exactly where yet, but that can wait until I get everything else working just how I like it. Now the process to get the weather is a multi step process. First we have the layout.

As I always suggest to people when they are doing design work for anything. Start with a piece of paper. It is much easier to sketch something out the try to throw things together on a computer. Now once you have the idea you have to get to work designing it on the computer. I did not start from scratch, but rather I took the file for the kindle weather display and modified to fit my needs. Now I am not an expert on any of what I am doing, I know just enough to be dangerous. When I redesigned the layout I got a little to ambitious. I suggest just modifing my file or the kindle one until you get it how you want.

Next we need to get the information. Again I took the kindle python script and added things until it got what I needed. This was one of the hardest parts of this whole project. I am not a programmer. I know the basics but this was one of my first real projects that used python. If I was asked to write the program from scratch I would be up a creek without a paddle and I probably wouldn't even have a canoe. After a lot of troubleshooting and research I was able to add the information that I wanted. Now whether you use my files or the files from the guy who orignally made the kindle picture from you are going to have to atleast edit the python file so that it has your correct location. there are 2 lines you need to modify. The first is the lat and lon in the 21 line of my file which is almost a direct copy of his. It is in decimal format so make sure you replace it with decimal format. You also need to find your local airport page. Go here, click on your state, then choose your closest airport. then look in the address bar. The webpage should be 4 letters.html. Change the last 4 letters of line 25 before the .xml to match the new ones.

The last step is to convert what the python script outputs and convert it to something that we can display. This is done using  rsvg that we installed in a previous post. {{rsvg file.svg file.png}} will convert a file with svg format to png. make sure that you include the directories if you are not in the correct folder. I have a script written that does this all for me automatically. Makes my life simpler. I like to run this ever 30 minutes or so and will get into that next time.

Left to do

  • Schedule events to happen and specific times
  • Program remote buttons to actually do what they are suppose to do
  • Add an input to monitor weather the monitor is on or off, will use the status led of the monitor as an output  
  • Make a cheat cheat for specific file locations
  • Build a nice frame
  • Gather pictures
  • Test
  • Give as present

Thursday, May 8, 2014

Raspberry Pi Picture Frame Post 6 Google Drive, Slide Show, Weather, IO

Step 5 Google Drive Continued

Well it took me a while but I did find a way to install grive and have it work. Thanks to Nathan HERE Below is the how to just commands no explanation why. Using a ssh program like putty will make your life much easier for this due to the steps after all the code runs. There are a few differences from his. First I added the wget to download the patch. Second I had to change the patch command because his downloadable files name changed at some point. At the end it will give you a website to go to to get authorization from google. Copy the website, go to it, accept the conditions (if you don't want grive to have access to your account then I suggest making another google account). Copy the access code to the terminal and hit enter. If everything goes according to plan, it will start synchronizing your google drive to the folder GoogleDrive (remember capitalization really matters in Linux) While you wait go get a coffee or bowl of ice cream or something, it may take a while. When it is all done it will say finished and you will have a command prompt again.

{{
wget http://www.nburles.co.uk/sites/default/files/attachments/State.cc_.patch

sudo apt-get install git cmake build-essential libgcrypt11-dev libjson0-dev libcurl4-openssl-dev libexpat1-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-test-dev binutils-dev libyajl-dev qt4-dev-tools patch

cd ~

git clone git://github.com/Grive/grive.git

patch ~/grive/libgrive/src/drive/State.cc -i ~/State.cc_.patch

cd grive

cmake .

make

mkdir ~/GoogleDrive

cp ~/grive/grive/grive ~/GoogleDrive

cd ~/GoogleDrive

./grive -a
}

Now that everything is copied you can type {{ls}} to see all of the files are copied. For my purposes if I am missing a picture or 2 its not the end of the world, if you are using this for a backup of files you may want to check to make sure everything copied. WARNING, you have to tell grive to check for files changes instead of it checking all by itself continuously. For a picture frame this isn't really an issue in my book. We will go over scheduling events later.

Step 6 Frame Buffer

Now I choose to use fbi, if I could find a command line based image viewer that had transitions I would but I havnt found that yet so I am sticking with fbi for now. The install for this is super simple
{{
sudo apt-get update
sudo apt-get install fbi
}}
Thats it. I wish grive could be installed that way.  Again the above and below comes from someone else work, I just brought it all together. His page can see his page HERE. Now he creates a folder to store his pictures in because he copies his pictures to the sd card directly instead of having it done automatically. Now he suggests creating a user that logs in when the device is powered and I see no reason not to so here is the code to do that. {{sudo adduser slideshow --ingroup video}}. This is going to ask you a bunch of questions. I hit enter 6 times then n then enter, then enter 5 more times, then y then enter. We now have a blank user created without a password named slideshow. Next we need to make that user log in at boot which is a little fun. First open inittab file by {{sudo nano /etc/inittab}}. Now we need to find a specific line {{1:2345:respawn:/sbin/getty --noclear 38400 tty1}}. When you find it put a {{#}} in front of it to comment it out. Add a blank line right after it and insert the following {{1:2345:respawn:/bin/login -f slideshow tty1 </dev/tty1 >/dev/tty1 2>&1}} Now exit with {{^x}} then y then enter. Now at boot the user slideshow will log in. If you did not want to create a new user you should be able to replace slideshow in the previous orange block with pi, now I am not sure if it will log in since pi has a password and slideshow does not.

So far we have gotten raspberry pi to boot, installed grieve and fbi. We can not get pictures off of google drive, and we can show them using fbi. Now its time to deal with the weather display.

Step 7 Weather display

The weather display was something that I added to what other people have already done. This was something that I thought would be a good idea, something that would take this project to the next level. My original plan was to use a web browser of some sort but I couldn't figure out how to get the web browser to load from the terminal so I changed tactics. I got the idea from the people who used an old kindle as a wall mounted weather display. What that group did was they used a webserver to download the information off the internet, and then convert it to an image than the kindle could the display. Well I thought, hey my picture frame is already setup to display images I just have to download the information. So I got the files I needed for the kindle project and made them fit my own needs. The first of which was adding information fields to the final output. See the kindle weather display only shows 4 days of weather total. Since I had a much bigger screen I figured I should show more information. I show 6 days of information, plus the day and current date.

There are 2 programs that we need for this to work. 1. is python which comes preinstalled. 2 is rsvg-convert. Now googling that may cause some problems trying to find the installer. that is because rsvg is part of librsvg2-bin so that is what we need to install{{sudo apt-get install librsvg2-bin}}. The reason we need this is because the python file creates a svg file and fbi will not display that. This outputs a png file which we can. Later I will come back to actually getting the weather information. You can download the weather files here.


Step 8 IO

Instead of adding buttons to the picture frame itself I decided it would be nice to have a wireless remote so that you could control the frame from your desk. Again there are multiple ways to access the gpio on the pi. I went with the way the guy did it from HERE. Same guide on how to setup fbi. Everytime the pi starts we are going to have to run a script to get the gpio setup correctly. I need 5 pins. 4 for input from the remote, and 1 output to turn the monitor on and off. Setup is easy enough, for each pin you need the following in a sh file. (you can download all of my required files here) Mine is called gpiosetup.sh. Every where there is an 18 make that what ever pin that you are currently using. I used 17,18,22,27 for inputs and 24 for an output. Now your probably curious why I choose those pins for those purposes. I choose those numbers so they would right by each other on the actual pin header. Here is a pin out I found on google.
{{
# export GPIO pin 18 and set to input
echo "18" > /sys/class/gpio/export 
echo "in" > /sys/class/gpio/gpio18/direction
}}
{{
# export GPIO pin 18 and set to output
echo "18" > /sys/class/gpio/export 
echo "out" > /sys/class/gpio/gpio18/direction
}}
No we need to create a script to check if any of the inputs are being activated.If you are downloading my scripts I called it IOcheck.sh. Since we want this to run continuosly we need to have a while loop. Button D on my remote is wired to gpio17. Since I had to do a voltage diver circuit to get safe voltages for pi I am not worried about setting up a pull up or down resistor in the earlier code. This also means I have a pull down physically installed. "$( cat /sys/class/gpio/gpio17/value)" gets the status of the button presses. I have found that I need to hold the button down for a little bit not just a quick press and release. In the if statement below I turn an output on for a half second, then off and wait a second. That output is wired to a transistor setup to act as a button that is connected to the monitor power button. This way I can physically turn the monitor on and off. Some people have chosen to just send a black screen or disable video output so the monitor goes to sleep but I would rather actually turn the monitor off. I may add in that if this button is help for an extended period of time it tells the pi to shut down, but I will save that for later. Copy everything between do and done below and paste it for each input you have.
{
while [ true ]
do
#Button D
if [ "$( cat /sys/class/gpio/gpio17/value)" == '1' ]
then
 sudo echo 1 > /sys/class/gpio/gpio23/value
 sleep .5
 sudo echo 0 > /sys/class/gpio/gpio23/value
 sleep 1
fi


done
}}

Wednesday, May 7, 2014

Raspberry Pi Picture Frame Post 5 Intial Setup, Wifi

Step 1 SD Card

Now that the hardware is ready it is time to remake the sd card so I don't have all the extra programs I installed last time while trying to get the system working. Now I am going to assume that you already have rasbian already installed, if you dont there are many different ways to install it onto an sd card but here is how I did it http://computers.tutsplus.com/articles/how-to-flash-an-sd-card-for-raspberry-pi--mac-53600

Step 2 Initial Setup

Once you put the SD card in the raspberry pi it will boot to a screen like below. First I suggest that you expand the filesystem to use the whole SD card. So just choose option 1.  If you mean to change the password you can use; option 2. For my picture frame I am using a command line based viewer so I am going to make it boot to the command line instead of a nice GUI environment.  Make sure you check your keyboard layout. It is under option 4 internationalion option. That's all that is needed for the initial setup. The default username is "pi" and the password is "raspberry"

 Step 3 Wifi

Since the whole point of this project is to have pictures updated without having to do anything to the frame wifi is a must. I happened to have a trendnet wifi adapter just lying around, if you are buying a new adapter the internet suggests that you get one of the ones that are known to work. I guess I got lucky that mine worked without much hassle. Getting the wireless to connect can be a pain and took me about an hour of changing this and that and rebooting alot. anything between {{}} double curly parentheses is what should be typed in. The first thin I did was to check to see that the raspberry pi saw the wifi adapter. To do that {{ifconfig}} will tell you all of your network interfaces. You should see 3 main groups. eth0, lo, and wlan0. If you do not see wlan0, your pi does not recognize your wifi card. Now if you google how to do this you will find a whole bunch of ways to do. Which is the best, I couldnt really tell you but this is what worked for me. Now that we know your card is being detected we need to look at the config file. to do that {{sudo nano /etc/network/interfaces}} for those of you who are new to linux the sudo command gives the current user administrator capabilites. nano on the other hand is a command line based text editor. Below is what your file should look like. I had to add a few things, you may not. (Edit 8/18/2014 Just looked up setup again because I am having network issues and there file was different so your setup may vary pending wireless card)
{{
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
}}
once you have your file looking the same it is time to exit. at the bottom of the screen you can see an information area. it says {{^X}} is exit so hold control and hit x. Not at the bottom of the screen it is asking if you want to save the changes. Hit the {{y}} key for yes. Then it asks for a file name. Since we dont want to change it just hit Enter. Now you can see the command prompt back at the bottom of the screen again. we have one more file to modify and you should have wifi.

In the last file we modified we referenced /etc/wpa_supplicant/wpa_supplicant.conf so that is the file we are going to change. To do that type {{sudo nano /etc/wpa_supplicant/wpa_supplicant.conf}} When I came into this file it had only the top 2 lines, so I had to add the rest. For your ssid and psk make sure that you leave the quotes("). When I was googling around some did not have the quotes and some did. Also this is extremely important. Make sure you capitalization is correct. This includes your ssid. This is why it took me so long to get the wifi connected. the # is a note for people reading the file, you do not have to type those lines but it may come in useful down the line.
{{  
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
update_config=1  
network={ 
ssid="YOURSSID" 
psk="YOURPASSWORD"  

# Protocol type can be: RSN (for WP2) and WPA (for WPA1) 
proto=WPA  

# Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)
key_mgmt=WPA-PSK 

 # Pairwise can be CCMP or TKIP (for WPA2 or WPA1)
 pairwise=TKIP  

#Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP) 
auth_alg=OPEN 
}  

}}
Now to save we need to {{^x}} to exit, then y to save then enter to save as the same file name.  
Now all we have to do is reboot {{sudo reboot}}. Yes you have to use sudo to reboot. If you don't believe me go ahead and try it without it. If you typed everything correctly when it is rebooted you should now be connected to wifi. To test this log back on , the type {{ifconfig}} again to bring up or network interfaces. The line under wlan0 you should see inet addr:xxx.xxx.xxx.xxx .That is your ip address. If you don't you probably miss typed something along the line, just got back and check everything for errors, if you don't find any, Google is your friend. The post that I mostly followed to do this is at http://www.howtogeek.com/167425/how-to-setup-wi-fi-on-your-raspberry-pi-via-the-command-line/

Step 4 SSH

At this point you can now unplug the keyboard if you want and ssh into your project. To do that you need an ssh program. On my computer I use Putty and from my phone I use JuiceSSH. Any program with ssh capability will work though. For the settings for ssh you should use the ip address that we just saw (warning this can change since we have dhcp enabled. some routers will consistently give the same ip address to each device, some will change them. You should be able to log onto your router to find out the ip address if it has changed) the default port number of 22 is what we need and then you just need the username and password that you have been logging onto the pi with.Warning when using putty to place copied text into the terminal all you have to do is right click. control v doesn't do anything

Step 5 Google Drive


Now I highly suggest ussing ssh to send commands to the pi at this point. The reason being is you can copy and past things to the pi instead of having to hand type everything. Could we have done this when setting up the wifi, yes you could have but then you would have had to have it hardwired into the router which some of you may have done when installing raspbian. For those of you willing to spend $15 I would suggest insync. I have no relation to them  but what they have worked flawlessly for me when I was using it. You can try it for 15 days before you buy but it is definetly the easiest way I have found for sync google drive. Now I am in no rush to get this project done and didnt find out until today that insync was only a trial so I am back to trying to get grive to work. When I find a way that works I will be back.

Whats Left to do

Install fbi. This is really easy
Setup tasks in cron to keep everything up to date
Redo my weather information. Plan on having the 5 day weather for 2 locations
Setup IO pins
Sure I am missing something but that's it for now

Saturday, May 3, 2014

Raspberry Pi Picture Frame Post 4 Mounting Components

Well I finally got back to working on this project. It has been to long but thats what happens when you have so many projects going on. I finally got everything mounted to the back of the monitor and the wiring finished, I have not had time to completely check the wiring due to the fact that I changed what IO I used so my config files were not setup properly. The next step is to make a new sd card that only has the required software on it instead of the having all of the extra programs that I installed when I first tried to get this working. After I know the everything is working properly it will be time to make the frame and finish up the project. So close to being done but yet so much more to go. Below you can see the final wiring and placement for everything. I may end up having a flash drive for picture storage that way I can have more space than just the sd card, but currently I need that usb slot for a mouse and keyboard.







Friday, May 2, 2014

Quad Copter Revision 2 Post 3

Well After getting the helicopter built the project got turned over to student in my class. They were designing and building quad copters. The students designed one and the components for it we could not get because they were back order or we were unable to buy things from certain websites. So I gave them the task of shortening the wires, getting everything all hooked up and making it fly. After a while the students were finally ready to fly. When the first spun the props up the little tabs i had holding the arm in the open position were not big enough, so the students replaced them with longer screws. The next time we spun the props up the arms were not strong enough and the one motor just ripped itself completely off the arm. In the hope of saving weight I had the walls on the arm set pretty thin as well as did not have much of a fill. I now have a lot of redesigning to do to strengthen the arms up so I can get the helicopter to fly

Thursday, March 27, 2014

Quad Copter Revision 2 Post 2

Here are pictures of the quad copter to date. Still needs the wiring buttoned up, battery retainer  and the power monitor mounted. Otherwise I think it is read to fly. I have some minor modifications to the cad files to keep the end user from having to dremel the parts to make things fit nicely.









Tuesday, March 25, 2014

Quad Copter Revision 2 Post 1

As we all know there is never just one project going on and this one has been going on a while as well. This project is partially job related. My first quad copter was made purely out of laser cut plywood. It got the job done and actually fly very nicely. This time I had access to a 3D printer. This quad copter was designed so that parts could be made with a 1 part mold. I added draft to the parts to allow them to release from the mold better. The quad copter was designed to be collapsible for easier storage and transportation.

Now I do have most of my parts already printed. and I have started to assemble everything. Unluckily pictures will have to come another day. Currently I have 13 pieces printed. All of the big pieces can be molded very easily. However before I do that I have a bunch of modifications to the cad files that I need to do. Once I get the files a little closer to finished I will put them all up of Thingiverse just like my first quad.

Parts list
  • 4x 1100KV MS2216 T-Motor (Link)
  • SkyWalker Quattro 25Ax4 ESCs (Link)
  • 4x 10x45 Props
  • Arducopter 2.6 (Link)
  • 3DR 915mhz Telemetry 
  • Custom Roll/Tilt GoPro 3 Camera Mount

Saturday, March 8, 2014

Raspberry Pi Picture Frame Post 3 Remote and 5v Power

Time for some pictures.Remember that I did have this all setup and working and I just don't have any pictures of that. One of the items I wanted was buttons for user input but I didn't want them built onto the display so I found this awesome remote on Adafruit that had a momentary receiver that it worked with. It also has a latching and toggle.

Most of you reading probably know that the raspi is 3v but this remote put off 5 volt signals. So I made a simple voltage divider circuit for each output. I think I used 2200 ohm and 3200 ohm resistors (they were what I had lying around) As you can see I covered the back in hot glue to make sure nothing short circuited. I also had a ribbon cable come off the board instead of the standard header.
The next step was to setup the monitor so I could use a digital pin on the raspi to turn the screen on and off. This was a simple npn transistor setup.The emitter is on the ground side of the button, the collector is on the 5v side and the base goes to to digital output. Make sure you have a resistor inline from the digital output or you are basically connecting your positive voltage directly to ground. The picture below is a little hard to see but at the right of the image you can see the transistor hot glued directly to the pcb. The resistor is in the heat shrink tubing on the top of the pcb and you can just see the white wire on the far right.
Since my monitor has an external power brick that feeds 14v into the monitor it was easy to get a dc-dc converter to make 5v output for the raspi and rf receiver. I decided to mount the converter inside the back panel with the pcbs from the monitor. There was a nice little space where I could bolt the board to the frame. I used an abs spacer from a screwed up 3d print to keep the board from short circuiting. I would have designed and printed a special holder but my 3d printer is currently broken. (a stepper motor shaft sheared off) I know I should have used different color wire for the positive and negative wires but red is what I had. The easiest place to connect the converter is directly to the barrel plug pins. The right picture is the back side of the metal enclosure. If you look closely you can see where I relocated the monitor buttons to. You can also see my 5 volt line coming out of the metal enclosure. Since I needed a signal wire, hot and cold I used a standard servo extension wire that I had lying around. This way I can easily disconnect everything from the monitor if necessary. I like to build connectors in when possible just in case something happens.
Next was mounting the raspi. Again I planned to print a nice mounting board but since I was on a roll I decided that I could reuse a miss print. To mount the board to the holder I drilled slight small holes and used metal screws to add threads to the holes. I used nylon screws to hold the board to the holder just because that is what I had lying around. To attach the holder to the metal enclosure I had to bend a piece to the holder up. Since 3d printers use thermoplastic (plastic that when heated above a certain temperature becomes pliable and when it cools it hardens again) I heated up a piece with a heat gun and bent it up 90 degrees. That lined up with a hole already in the metal enclosure. I had to drill a hole in the enclosure to secured the holder to the enclosure better. Below you can see things starting to come together.
Next I need to mount my rf receiver, and make my connections between my raspi, the rf receiver and the power transistor. In theory the only other thing to do is make a nice frame and the project should be done, but we all know it is not that easy. I plan on making a new sd card with only the required software on it instead of having all the extra stuff from when I was trying to get everything working.