Arduino Nano ATMega 168 at NESIT

Arduino Nano featuring an Atmel ATMega 168 microcontroller
Arduino Nano Clone

Arduino development boards aren’t anything new. Hopefully everyone’s had the opportunity to crack out a design on one and watch their LEDs come to life as they press an SPST momentary switch.

But if not; now is your time! NESIT now has a Arduino Nano v3 (with an Atmel ATMega 168, which is confusing) clone in the “Arduino and Arduino-like” box.  The box it’s stored in is a white four drawer unit on the back shelf of our electronics area.

Continuing our theme of Micro Monday we’ve got some resources for working with the board.  What you might notice examining it after looking at the reference specification from Arduino Corp. is that there are a few extra features packed onto the pint sized part.  We’ll figure out what they are and add them to the reference doc (this post) as we do.

Since the Nano has an on-board serial controller all you’ll need to work with it is a USB A to USB Micro cable from the cable wall. In addition, you might want to grab a small breadboard for when you’re adding a component or two for your programs to interact with.

And in case you’re a more visual person here’s a nice colored diagram released by bq.com under an open license. Click for a full size version.

Diagram of a Arduino Nano's pins
Diagram of a Arduino Nano’s pins

ESP8266MOD Development Board at NESIT

AI_Thinker-ESP8266MODSince a few people have been asking there’ll be an ESP8266MOD development board available in the Electronics work area of NESIT.

The ESP8266MOD is an all-in-one IoT enabling chip that mates an ATmega like core (read as: what’s on an Arduino) with a dedicated WiFi 802.11 b/g/n signal processor. It’s a bit harder to program for than a straight Arduino with a super compact footprint that makes up for the added difficulty.

A note on programming.  This unit (the ESP8266MOD with breakout board from AI-Thinker) is working with the settings NodeMCU 1.0, CPU Frequency 80Mhz (although it may work with 160Mhz as well), Flash Size 4M (3M SPIFFS), Upload Speed 115200.

Feel free to grab it and test it out.  Just make sure it gets back to the Arduino and Serial breakout bin (now labeled) when you’ve finished.

Resources to get you started:

***UPDATE*** The pinout for the break-out pins on this board are as follows:

  • GPIO4 – Button
  • GPIO12 – Green LED
  • GPIO13 – Blue LED
  • GPIO15 – Red LED
  • ADC – LDR, 470 Ohm resistor

Learn How To Can Foods/Jelly

DemonJelly

When: Wednesday, February 10, starting at 7pm.
Fee: $7.

The cooking portion will be done ahead of time at home so the class will only show the canning process itself. Start to finish the process is three or more hours, but most of that time will be spent waiting for the pressure canner to cool off enough to open. Actual class time is probably closer to 1.5 or two hours.
We will start with the water bath canning for a jelly followed by the pressure canning for a chili. We’ll also show vacuum canning using a brake line bleeder.

In the meantime if you want to get an overview of the practice here’s a pretty good video about it:

Routers, Trigonometry and Laser Cutters

making a router baseYou probably asked all of your math teachers “when and I’m going to use this stuff?”. Well that day is today. NESIT has a hand router that is missing the base plate. The base plate allows the router to smoothly slide across a piece of wood without getting hung up while also providing a sturdy base for the user to hold the router. NESIT has the technology available to make a replacement. Here’s how it’s done… and guess what, it includes some fun math!

We’ll need a few dimensions to make the router base plate. The diameter of the base is easily measured, the screw hole size is easy to determine and for the inner diameter, 2 inches was picked just because it seemed right. The only think left was to determine the spacing of the mounting holes for the screws. There are 3, making it difficult to directly measure the bolt hole circle diameter. The bolt hole pattern is the size of the circle the screw holes are spaced on.

Although we can’t measure the bolt hole pattern directly, we can do it in-directly using our friend Math. We start by measuring the distance between two of 3 screw holes that are in the base of the router. You could use a ruler to eye-ball the spacing but that is quite inaccurate. Using a caliper to eye-ball the distance between the holes is also kinda sketchy. There’s a trick you can do with a digital caliper to measure the center-to-center distance between two holes. Screw in screws to each hole. Then, instead of setting the digital caliper to zero with the jaws closed, set the caliper to zero with the jaws tightened on the screw diameter. Then use the calipers to measure the outside of one screw to the outside of the other. The value displayed on the digital caliper will be the center-to-center distance which is the value we need for our math equation later. trig-caliper1

trig-caliper2

To help illustrate our situation, let’s draw a representation of the screw holes and their locations. It doesn’t necessarily have to be to scale or dimensionally accurate. Drawing some lines between the center of the bolt hole circle and each screw and another line between the two screws we measured creates a few triangles. These triangles will simplify our calculations, even if the high-level task seems a bit daunting. Such a drawing would look like this:

trig-drawing

Our goal is to determine the bolt hole circle radius. We need that value in order to draw the hole position accurately in Corel Draw because the plate will be cut out using the Epilog laser. Looking at the triangles that we just drew, we notice that the radius of the bolt hole circle is one of the sides of one of the triangles (highlighted orange). We know one of the angles is 60 degrees and also know the length of one of the sides (because we just measured the screw center-to-center distance using digital calipers). The center-to-center distance turned out to be 4.642 inches, and our triangle side is half of that: 2.321 inches.

If you think back hard to good ole Geometry class from high school, you’ll remember the trigonometric mnemonic device: SOH CAH TOA. That saying reminds us how to use the trigonometric functions Sine, Cosine and Tangent. We’ll use one of these to calculate the bolt hole circle radius of the Router’s base.

Using the SOH from SOH CAH TOA, we recall that Sine of an angle equals the length of the Opposite side divided by the length of the Hypotenuse. So…

trig-tri

Sinθ = O/H

Sin60 = 2.321 / H

Sin60 * H = 2.321

H = 2.321 / Sin60

H = 2.680 inches

See, easy! We now know that the radius of the bolt hole circle is 2.680 inches. We use that dimension to position the center of the screw hole 2.680 inches above the center of the Outside Diameter of the plate. Copy that top hole 2 times and rotate those 120 degrees left and right and we have our plate mounting pattern. Before using up some valuable acrylic, a cardboard template was made to test the fit. It was dead on! After the plate was cut out on the laser cutter, the screw holes were countersunk on the drill press. The following photos are of the final product.

making a router base

making a router base

making a router base

Recycled Laptop Becomes Linux Media Server

I cut my cable service quite a while ago. I have no regrets for sure. There are a few shows that I dig so I just download those, throw them on a flash drive and walk that drive over to plug it into my WDTV media streamer. It works but it’s annoying. I could stream it from my computer but even though the WDTV is connected via ethernet, my laptop isn’t and the resulting video is not smooth at all. I decided it was time to create a stand alone media server that would be responsible for both the downloading and storage of the TV shows and movies, keeping my main computer free to do other stuff. The WDTV would then stream content directly off the media server and Bob’s your uncle. The plan was also to have the media server tucked out of the way and I’d remote desktop in to do any maintenance or what evs.

This project started off with a desktop PC (and with the help of Chris B) got a fresh dose of Ubuntu Server and some SSH and VNC software. Everything worked great at NESIT. When I got home it quickly because clear the setup wasn’t going to fly (read: I’m Linux illiterate). Without my own personal live-in Linux expert, I was going to be up a creek without a paddle. And the PC was way louder at my house than at NESIT, go figure.

So I was thinking, my current computer is a Dell laptop and it is dead silent. The light bulb went off and I decided to change the course of my project, ditching Ubuntu Server and roar of the PC and replacing it with an lower-power-consumption Dell laptop. This puppy already had a 500gb drive. After reading how to build the perfect media server, I decided Ubuntu Desktop would be the way to go on the older laptop I was using.

So what’s the point of this article? Not to blab but to share the hurdles I faced with the project.

Sharing files between Windows(or Media Streamer) and Linux isn’t super straight forward.

My main personal computer is running Windows 7. You may expect that with both a Windows and Ubuntu computer plugged into the same network that each computer could see the other. Wrong assumption.

With a fresh install of Ubuntu, you need to go to the folder that will be shared. Right click on its icon and select ‘Local Network Share’. A dialog box will appear where you can check off ‘Share this folder’. Do that and press ‘Create Share’. Since this was a fresh Ubuntu install, a message pops up and asks if you want to install a program (samba) that will allow the Windows and Ubuntu computers to talk to each other. Ubuntu walks you through the install process.

Next, still on the Ubuntu machine, you need to modify a file. In the terminal, type: sudo gedit /etc/samba/smb.conf   Right in the beginning of the file you’ll see this: workgroup = WORKGROUP  The uppercase ‘workgroup’ name needs to match the workgroup of your Windows machine. You can find this by going to the Windows 7 start menu, in the search area type ‘workgroup‘, then select ‘show which workgroup this computer is on‘. For example, if the workgroup on the Windows 7 machine is NESIT, you would change smb.conf to workgroup = NESIT .

Ubuntu has a firewall installed by default, I had to disable it to in order to get the file sharing to work, to do this type: sudo ufw disable 

After this, the Ubuntu machine could see the Windows machine, but not vice versa. A restart of the Windows machine fixed it. Now, from the Windows machine, I could see the folder I shared on the Ubuntu machine. By ‘see’, I mean in Windows Explorer, clicking on Network, then the Ubuntu computer’s name. After moving a video file in the shared Ubuntu folder, I did a test stream of that file to my Windows computer. It worked well.

Remote Desktopping into Ubuntu from Windows

I can say I learned a bunch with this project. It wasn’t fun. Keep in mind I’ve never done any remote desktop or VNC stuff before. After trying a bunch of software, I found a combo that worked well. I won’t bore you with what didn’t work with my pea-sized brain.

On the Ubuntu computer, I installed X11VNC Server using the Ubuntu Software Center. In Windows, TightVNC seems to be the winner for VNC clients. Now begin hours of research to set these up. In X11VNC, you’ll need to create a config file: /etc/init/x11vnc.conf   This file does a bunch of good stuff: 1. Auto-starts X11VNC when Ubuntu starts up, 2. Allows multiple login’s and logoffs (otherwise you can log in and off once and X11VNC shuts down), and 3. saves the X11VNC password. The file’s contents should be as follows:

start on login-session-start
script
x11vnc -shared -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -rfbport 5900
end script

Save that file. There are about a billion different customizable commands for X11VNC. Check them out here: X11VNC Command Line Options. The above script worked for me.

Next we need to create the referenced password file. In the terminal, type: x11vnc -storepasswd YOUR_PASSWARD ~/etc/x11vnc.pass    Make sure to change “YOUR_PASSWORD” to what you actually want your password to be. Remember this password because you’ll need it when VNCing into the Ubuntu computer from Windows 7. If that command string doesn’t work, try just x11vnc -storepasswd per these instructions.

Find out the Ubuntu IP Address by typing ifconfig in terminal. The IP Address will be up near the top in the ‘eth1’ block right after ‘inet addr:’. It would look something like inet addr:192.168.1.1

Now, back on the Windows 7 computer, open up TightVNC Viewer and in the ‘Remote Host’ area, type the IP Address of the Ubuntu computer and the port number. For example, it could look something like this 192.168.1.1::5900  Notice the IP Address and port number are separated by to colons “::”. Press “Connect” to remote desktop into the Ubuntu computer, you’ll be prompted for that X11VNC password you just created. The 5900 port came from the x11vnc.conf file we created. See, it’s listed after “-rfbport”.

Laptop Lid Shenanigans

The plan was to have this laptop tucked away out of site, and that means having the lid closed. Unlike Windows, Ubuntu doesn’t have a good GUI-based option for telling Ubuntu what to do when the lid is closed. Ubuntu defaults to ‘hibernate’. To change this setting, logind.conf needs to be edited by typing:

Open the /etc/systemd/logind.conf file in a text editor as root by typing:
sudo -H gedit /etc/systemd/logind.conf

Then add the line HandleLidSwitch=ignore . Then restart the systemd daemon with this command:
sudo restart systemd-logind

SickBeard, CouchPotato and SABNZBD

LaptopMediaServerSickBeard is a program that searches for and facilitates downloading of your favorite TV shows. When a new episode is available, SickBeard will download it. CouchPotato is a similar program but for movies. Another program called SABNZBD does the actual downloading. Over at www.howtoforge.com there is a great tutorial on how to set these programs up. The process is not easy or intuitive but the tutorial makes setup a manageable task.  Although the post was written towards Ubuntu 11.10, it was totally fine with Ubuntu 14.04. SickBeard and CouchPotato were set up to save the video files in the /home/user/video folder, the same folder that was made ‘network shared’ at the beginning of this post. That way, my media streamer will be able to see the newly downloaded content.

Conclusion

So now I’m considering my media server done… for the time being. The re-purposed old laptop has found a new life as my media server. It is tucked away out of site and consumes much less energy than desktop tower. I can remote-in if some sort of maintenance is required. And the best part is that my WDTV can play files located on the laptop and stream them to my TV.

An update before even posting this…

I was having a 50% success rate with my WDTV media streamer connecting to the Ubuntu laptop shared folders. This Linux noob doesn’t know why. In my search for a solution, I tried media server software Serviio, and installed it using these instructions. Those instructions left out an important part, Serviio needs Java 8 installed to run on Ubuntu. To install the needed packages, I did the following:

Install Java 8:
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer

Serviio is a great software. The WDTV connects every time. Serviio has a bunch of ways to browse your media. You can go browse by file name, show/movie name and(but not limited to) my favorite: new unwatched additions.

WIFI Playground – Whitehat Wednesday

playground

Tonight for Whitehat Wednesday @ 7pm we will be playing with some WIFI related toys we just received. Yagi, parabolic, & panel antennas. WIFI Pineapple & Alfa WIFI card. ESP8266 WiFi Module. WIFI cracking programs/scripts.

Swing by if you would like to demo them. A few knowledgeable guys will be here for any questions you may have regarding anything WIFI.

We will be having another WIFI cracking class in a few weeks so get familiar now with the tools and techniques we will cover.

Dual Monitor Setup Goes Vertical

Sometimes my pal John and I get together to kick butt on a project at his place. The one problem with bringing my laptop over is that I suffer without my dual monitor setup. I could bring a second monitor but Johnny doesn’t have the desk space available for it. Today I had an idea: Don’t put the extra monitor on the side of my laptop, put it overhead! It’ll take up less space and I’ll be able to have dual monitors. That’s a win-win situation.

Picking the Best PC Monitor

The NESIT stockpile of LCD monitors puts any Best Buy to shame. There were several LCD screen monitors to choose from. None of them were tall enough to put the second screen over my laptop screen so making an extension adapter would be necessary. Some of the Dell monitors had a funky stand mount and that’ll require more effort than I want to put into this project. There was an HP LA1751G 4:3 monitor with a standard VESA mount on both the monitor stand and the monitor itself. Perfect! The base of the monitor stand was also nice and big, a large base is necessary for an extra tall structure. Another benefit is that  the new monitor is about the same width of the laptop monitor. They line up nicely. Dual monitor setup, here I come…

Making the Dual Monitor Stand

Dual Monitor Stand Adapter PlateDual Monitor Stand Adapter PlateAfter taking a couple measurements of the current monitor stand and my laptop LCD, I figured 4 inches would be a good amount to extend the new monitor. The VESA mount screw holes were spaced 100mm, and since 100mm is pretty dang close to 4 inches, I went with a 100mm spacing. In doing so, the bottom mounting holes of the monitor will now align with the top holes of the monitor stand. Even so, an adapter plate will still need to be made to fully support the monitor’s new position. The adapter plate was drawn up in 3 pieces in a CAD software and imported into Corel Draw for use with the Epilog laser cutter. The old tenant of NESIT’s current space left a bunch of 1/8th inch mirror plexiglass behind. The mount was designed around that material because there was such an abundance of it. One 1/8th inch piece of plexi wouldn’t be strong enough to hold a monitor, hence the 3 pieces that will be super glued together after a quick sanding and wipe-down to remove any leftover dust.
Vertical Dual Monitor BackVertical Dual Monitor Front

Here is a shot of the final product, sans some ideal 4mm hardware. Notice the ‘custom’ power cable that splits off to both the laptop power supply and the second monitor that results in only having to plug one cord into the wall. The power supply is also secured to the monitor stand in an effort to keep this thing as portable as possible. And the cherry on top is that the monitor actually has a handle for easy transport of the rig, which is the primary reason it was made.

Setting up Dual Monitors in Windows 7

It is easy to set up Windows for using dual monitors. First, plug in the monitor to the laptops VGA port and turn on the monitor. Windows will probably make the new monitor a duplicate of the laptop screen. That can be changed…

In the search area in the Start Menu, type in ‘display’. In the search results, click on ‘connect to an external display’. In the next dialog box, there will be a handful of settings to change. Start by pressing the ‘identify’ button. This will show you which monitor is which in the dialog box. Then, adjust the monitor orientation in the dialog box to mimic that of your physical monitors. Then change ‘Multiple Displays’ to ‘extend these displays’ to allow your mouse to move between monitors and double your desktop area. Done deal! Check out this ling for a more in-depth instructions on setting up Windows 7.

dual monitor setup windows 7