Dad Pranks

Here is a list of things I did with my children when they were little. Toothbrush Song –We would hum a song while brushing our teeth to ensure they were brushing long enough. I never told them the song was the theme to Dark Shadows. Years later, my daughter was watching the movie version of Dark Shadows and discovered the theme was the toothbrush song. Pick your favorite show and have at it. The Answer is Lincoln –I would ask them a series of questions to which the answer was always Lincoln. For example: Name a luxury model car made by Ford. What is the capital of Nebraska? Name the 16th president of the United States. Whose face is on the penny? Then when you are boasting about your kids in front of someone ask them one of the questions. The more obscure the better.You can do this with any specific answer as long as it is always the same. For an extra laugh, expose the trick by asking a few more questions. I got a Haddok too –For this one I teach them a short skit from a Marx Brothers movie, but you can use any short silly skit. This one goes like this: “Who are you?” “I’m fine thanks, who are you?” “I’m fine too but you can’t come in unless you give the password.” “Alright, what is the password?” “Oh no, you gotta tell me. I’ll give you a hint, it’s the name of a fish.” “I got it, haddock.” “That’s funny a gotta haddock too.” “Really, whaddya take for a haddock?” You can choose who does what part, but I usually let them do the second part so I can start.

Keep on Learning

If you are in a technical field you may already do this and if you don’t then you need to or you’ll quickly lose relevance in your specific discipline. If you are not in a technical field the advice still applies as things are always changing. Keep learning. I am an Electrical Engineer and with a four year degree I was often told by professors that this qualifies me to do absolutely nothing. What you are qualified for is learning. I had to be mentored by another engineer for two years before I really knew how to do anything, and then had to complete some projects working with others that knew more than me and from whom I could grow my skills. This was a huge advantage early on in my career. Without these mentors I might never have grown. Over time I have moved from job-to-job and doing this has caused gaps where there was no one to learn from. Technical design work can fall into an echo chamber, where inspiration is stifled. When this happens it is imperative to find others who know more than you or other resources of knowledge from outside the organization. This can be accomplished via professional organizations and clubs if you have the time to commit to this. With the internet, the resources for learning online are endless and available when you are. So much of it is absolutely free. Although the quality can vary greatly, it takes very little effort to find some pretty decent resources. If you are interested in something a little more structured to hone your skills, I recommend services like Udemy. The courses are so inexpensive, but very structured. Like anything, what you get out is directly proportional to what you put in, so keep learning.

Grafana Dashboards

Grafana is another one of those amazing GitHub projects that is completely free and licensed under the permissive, MIT license. I actually never heard of it until I attended a Rockwell Automation Fair in Philadelphia and just started talking with a random attendee at the lunch table. When I explained that I work for an OEM and was trying to find ways of providing some value added web based features to the product he mentioned using InfluxDB and Grafana. The funny part was that he said it kind of on the sly like it was some trade secret. In retrospect I can understand why, now that I’ve had a chance to use it. It basically does, for free, what many of the high-end pay for products do. Many of those products being showcased at the fair. Because the product is targeted at IT, it seems that no one in the manufacturing automation and data sectors have ever heard of it. With this said, in my opinion Grafana is tremendously useful in these sectors. Here is an example dashboard for server temperatures and environmental temperatures. (I wish I could show some real life examples from the furnaces I work on, but the information is private.) For our OEM offering, FIN Historian is being used on the back end to do the data collection from a Wonderware OI Server using the DDE plugin. All of this resides on a core i5 HMI PC with 8GB of ram. Grafana easily connects to any real-time database. This means the data MUST be date time stamped. In the case of most historians this is not a problem. When I have some time I’ll post the steps required to setup drill down and move your Grafana dashboards from static images to real reporting tools.

Free ABCIP PLC Communications Using Python

I have been using a GitHub project called pylogix by GitHub user dmroeder to do some basic data retrieval from ControlLogix and CompactLogix PLCs.  While the project has been around for a while there has been some more recent activity and the code has become pretty reliable. I have used it to pull data from PLCs where that data does not change readily, for example recipe data or setpoint data.  Another great use is for turning Raspberry PIs into remote IO devices by having them push data to a PLC.  This can be useful for monitoring a fire pump run status in a remote pump house or for monitoring the temperature and humidity of a control room where there is no PLC and cost is an issue.  I will try to post more examples of industrial uses for Raspberry PIs in the near future, but wanted to give a shout out for this project since it is quite good. https://github.com/dmroeder/pylogix

Recommendations for Trying Linux

I recently sent this to someone interested in trying Linux and figured I would post it here for anyone else: Dan, I recommend Ubuntu for anyone just starting out in Linux on the desktop. https://www.ubuntu.com/download/desktop Use the top one, 18.04.1 LTS (Read the system requirements. If you are installing on something that does not meet these requirements, let me know. There are other distros that work on lower spec PCs.) Installation –  You will need to burn the downloaded iso to a DVD or to a thumbdrive. There are plenty of tutorials online for doing this. I use Etcher to put the image on a thumbdrive. https://www.balena.io/etcher/ You will also need to know how to tell your computer to boot from the installation media (i.e. DVD or thumbdrive) Once you get that far follow these steps https://tutorials.ubuntu.com/tutorial/tutorial-install-ubuntu-desktop?_ga=2.137457650.372567711.1546946782-835315326.1546946782#0 Some things to keep in mind when trying or transitioning to Linux on the desktop:  It is not Windows so things will work differently. (Think of going from Windows to Mac.) I recommend using the stock install for a period of time before breaking your stuff by tweaking and make no mistake, you can tweak the hell out of Linux and there is a ton of information on the internet. When you search the internet for help follow these guidelines: Stick to help for your distro and version (Ubuntu 18.04). Set your search tools to results in the past year. (Old results may contain useless instructions. Linux is updated regularly.) When you find instructions to do something on a forum, don’t forget to look at the comments below. People will often correct instructions or provide alternate solutions in the comments. Compare multiple solutions to a problem before settling on the best course of action. For example, I have found 10 pages of instructions using one method that was accomplished with two commands using another method. If you are really going to make the move, take notes. You will do something and later want to duplicate what you did. The beauty of Linux is that it is free so you can install it again and again. While I am no expert Linux is a passion of mine so feel free to tap me when you need help. The laptop and screen on my desk to the left is running Ubuntu 16.04 and I’ve been using Linux successfully since 2010. Have fun, Dave

Raspberry Pi Setup

RPi Setup for Specific Use Cases I’ve added some notes here to assist with setting up a Raspberry Pi for different use cases.  These notes were consolidated from many other sources and as versions change and things are updated these instructions may not always work, but here they are for anyone’s use. Initial Setup Install using standard Noobs or Rasbpian with Desktop. Using Raspi-Config enable the Camera and SSH for future use. Change the Node Name, change the password, set the localization. Note: You have to scroll up to get the English US keyboard after selecting the US. Drop the background to just grey, no image. Remove all the icons but the terminal from the top panel. Resolution for 7” Monitor Open raspi-config and set the resolution to 28. Add plantfloor User Reference: https://www.raspberrypi.org/documentation/linux/usage/users.md sudo adduser plantfloor Add sudo sudo visudo Find the line under the commented header # User privilege specification: root ALL=(ALL:ALL) ALL Copy this line and switch from root to plantfloor. To allow passwordless root access, change to NOPASSWD: ALL. The example below gives the user plantfloor passwordless sudo access: # User privilege specification root ALL=(ALL:ALL) ALL plantfloor ALL=(ALL) NOPASSWD: ALL Save and exit to apply the changes. Be careful, as it’s possible to remove your own sudo rights by accident. Also, make sure this line is the LAST line in the file. Assign Static IP sudo nano /etc/dhcpcd.conf. interface eth0 static ip_address=192.168.1.XX/24 Optional: (Only do if internet access is required.) static routers=192.168.1.1 static domain_name_servers=192.168.1.1 Make plantfloor the Default Auto Login sudo nano /etc/lightdm/lightdm.conf Uncomment these two lines: autologin-user=plantfloor autologin-user-timeout=0 WARNING – These lines may occur in a different section. Look for the [Seats:*] section. (The last section. You’ll be replacing the pi autologin user.) Reboot and then: Drop the background to just grey, no image. Remove all the icons but the terminal from the top panel. Install Thunar for Network File Access Since this is the first package we are installing, be sure to at least run: sudo apt-get update to refresh the repository locations. sudo apt-get install thunar For Python PLC Comms Copy the pylogix_master folder from the 10_Installables on the NAS. To access the network folders you will have to use Thunar. Enter smb://<ip address of pc with shares> into the address bar. Reference: https://github.com/dmroeder/pylogix Add RDP Support sudo apt-get install xrdp Make a Python Program Run on Startup Putting it in the users autostart file should have worked. Don’t use “sudo” that file belongs to the user. Code: nano ~/.config/lxsession/LXDE-pi/autostart Add the program to the bottom like this: @sudo /usr/bin/python /home/plantfloor/python_apps/<program name.py> The autostart file won’t run until after login to the desktop, even if the login is automatic, since it has to know who the user is to apply the correct desktop settings. By that time the rest of the system is ready. Piface Digital 2 Installation Install the packages if not installed already. sudo apt-get install python-pifacedigitalio or sudo apt-get install python3-pifacedigitalio Apply the patch to the python2.7 folder to fix … Continue Reading →

Install ODBC Support for Linux

These instructions come from many other websites and I have consolidated them for what has worked for me.  If this also works for you, then that’s a good thing.  I have used these instructions to setup ODBC connectivity from Ubuntu 16.04 to a MSSQL server running 2008r2.  Then I have written applications using this ODBC connection in Gambas. Install Required Packages sudo apt-get install unixodbc unixodbc-dev freetds-bin Download and Compile FreeTDS cd /usr/local sudo wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz tar xvfz freetds-stable.tgz cd freetds-0.82 ./configure –enable-msdblib –with-tdsver=8.0 –with-unixodbc=/usr make make install make clean Test Connections telnet <ip address of SQL Server> 1433 Should result in: Connected to <ip address of SQL Server> tsql -S <ip address of SQL Server> -U <username> Should result in: 1> Create Configuration File In the home directory create .odbc.ini – [mssqlserver] Description = MS SQL Server Driver = /usr/local/lib/libtdsodbc.so Server = <ip address of SQL Server> UID = <username> PWD = <password> ReadOnly = No Port = 1433 TDS_Version = 8.0 Test ODBC Connection isql -v mssqlserver <username> ‘<password>’  

A Test Run of Ubuntu Gnome

When Ubuntu made the decision to go off on their own and develop their own desktop environment it didn’t bother me too much.  To be honest, once Windows 7 let you simply press the super key and start to type the name of the application you want to launch I pretty much stopped using the start menu all together.  (I still thinks it’s funny watching people struggle to find the application they want to start by navigating the huge monstrosity that is the start menu.)  I fell into using Unity and was very happy with the 14.04 and then the very usable and stable 16.04 LTS versions.  I instantly fell in love with the HUD, since I can never remember where the page landscape menu option is in LibreDraw or the emboss transform in Gimp.  To me, it was like the Unity developers had mind melded with my keyboard centric work flow. Well, now I have to begin switching to Gnome and so I spun up an 18.04 VM and began fiddling with it.  I went into the settings dialogue and checked out the keyboard shortcuts.  I tried simply changing the workspace navigation keyboard shortcut and the settings window locked up.  I clicked on the close button for the window and it wouldn’t close.  I waited several seconds for the window to popup allowing me to force quit the application, but it never appeared.  Finally I decided to reboot and install the latest updates.  After doing that I began again customizing some simple things.  I decided to change my wallpaper.  I opened the settings to change the wallpaper and saw a nice interface that even previewed the wallpaper and let me change the lock screen wallpaper as well.  Then I discovered that it won’t let you pick a picture from any folder, you’ve got to put the picture into the Pictures folder.  Fine, I tried to do this from files (Nautilus) and then once again, the files app locked up and nothing worked on the desktop.  Just my mouse.  This time I had to reboot the system to even get out of the locked desktop.  Even though I have had the infrequent app fail in Ubuntu, it NEVER took out the whole system. I don’t know.  I looked online to see if anyone else is having stability issues with the transition and everyone seems fine or comments on how much better Gnome is.  I must be doing something wrong because this Gnome desktop does not seem as polished or stable as Unity was.  Maybe I won’t move from 16.04 just yet. 🙁

Love My Chromebook (Provided it’s Served with Croutons)

I bought an Acer CB3-111 for $150 after reading several reviews on Amazon.  This is an 11″ Chromebook with a full fledged Intel Celeron processor.  Immediately after getting it I downloaded the latest Crouton.  For those that don’t know, Crouton is a great little tool for installing and running Ubuntu on your Chromebook.  The process takes about 5 steps and the most annoying thing about the whole process was having to boot the Chromebook into Developer mode and wait the 20 seconds while it says “Hey your booting into Developer mode and should press a key to completely not do this.”  HAHAHA….NOPE!!  Unfortunately, every time you boot the Chromebook it will display this warning and you will need to wait without touching it.  Since I don’t ever turn it off, this is generally not an issue.  I don’t include the steps for installing Crouton, just Google it, there are plenty of sites that give detailed instructions. Once Crouton is installed and you have loaded and launched your favorite flavor of Ubuntu, mine was Xubuntu, now you have a full laptop.  Since this thing is all solid state, I got a hard plastic shell for it for an extra $20 and lug this thing around with me everywhere.

Raspberry Pi 2 4G Raspbian Image Gotcha

I ran into an issue setting up a new 8G micro SD card for use with my Raspberry Pi 2 and wanted to capture the description of the problem, here, because I wasted at least 2 hours fighting this and not finding anything on the internet that described the exact problem I had.  The final solution was a real “DUH!” moment. Steps: I simply downloaded the Raspbian generic image and used dd to load the image onto my 8G SD card.  Then booted the Pi 2 with new image successfully and then ran sudo apt-get update and finally sudo apt-get upgrade.  The upgrade seemed to take a long time, but I wasn’t too concerned since this is a Pi, not an AMD 8350. Symptoms: – The upgrade took a long time. – After the reboot the Pi would not show the normal system loading screen, only a black screen with a sporadically flashing cursor in the upper left corner.  The green LED would flash and almost make it seem like it was going to do something, but nothing ever happened. Problem: The actual problem is a matter of storage space.  Palm to forehead!!!  The files of the Raspbian image took up the majority of the 4G partition it created on the 8G SD card.  Then when I ran the upgrade the packages that were downloaded completely filled the remaining space and didn’t successfully install.  Because the upgrade took so long I walked away and didn’t babysit the install and figured everything was okay. Rebooted and WHAMMO!  NO JOY!!!  I kept thinking something was wrong with the SD card. Solution: The key is to resize the disk to expand the partition back to the full 8G size.  There is a simple way to do this right from the default GUI.  THEN, do the apt-get update and upgrade.