Author Archives: chad.e - Page 17

Converting my Code to a WebApp

I'm converting my program to a webpage!  Using Python + Django.

Since I'm a Network Admin, I know keeping programs up to date can be annoying.  A Web app on the other hand, can be updated once and its everywhere!  Not to mention the compatibility of just needing a new'ish web browswer to run the thing.  

Well, here it is after about 4 days, learning what I needed, how to use what I needed and actually making the program.  Here's a screen shot.

WebApp1

I have it displaying multiple sensors, which the readings get updated every time you goto the page. Most of it is self explainitory, although the funny dashes and colour after "Colour: ", is the actual colour representation of the RGB light sensor.  

Now I have to bring over the other stuff like updating sensors, rebooting devices and downloading the longer term sensor logs.  

 

 

 

Using Python3 to collect and manipulate SenseHAT Sensor data

So, as I said in my last post, I want to digitize the world around me, starting with the sensors on my Raspberry Pi 3B+ and SenseHAT attachment.  

After much thinking, writing down ideas and generally trying things out, I finally got things working the way I wanted for the most part.  Here's what I have so far.

1.  Sensor Units: These are the Pi's with the SenseHAT and have the following programs running to enable the features I want (Only the HTTP server is not done by me, I just installed one). 

  • Sensor Readings to File: A simple program that reads "all" the sensors and writes the results as a string, each value separated by a ",". It creates one line each time its run.  It auto runs every 5 min through cron (Linux scheduler).  You could also do something similar with Windows "Task Scheduler".
  • HTTP Server:  The HTTP server just lists and allows downloads of the sensor data files. 
  • SenseHAT Joystick Controls: A small program auto runs with the pi and allows you to use the 5 "button" joystick to run commands and display info on the 8×8 LED grid.  It currently does the following, which helps a great deal when there is nothing attached but the SenseHAT and power.  I also have VNC / SSH enabled on the Pi's to connect remotely.  
    • 1. Display IP
    • 2. Display CPU Temp
    • 3. Display SenseHAT Temp
    • 4. Shutdown
  • Sensor Data over WiFi: Another small program runs automatically and listens on the network for my client app to request data.  

2.  Portable Sensor Data Display and File Downloader:  This is a PI with a 2.7" E-Ink display with 4 buttons.  It simply runs one program on boot to do the following.

  • Show it's own system information, including IP
  • Display Current Sensor Readings
  • Download Sensor Data Files
  • Shutdown

3.  PC: I made a more in depth GUI app for the PC, that can connect remotely to the units to gather information.  It has a lot more options, and is a bit easier to show a picture. 

Its still a work in progress, but as you can see, I can already compare Sensor readings over time.  I can also specify how many entries to skip when graphing the data files, as there should be about 288 entries for a day, after which, the program creates a new file for that day.  Plotting 288 points can not only take a bit of resources, but also isn't needed for most things being looked at. So I set it at 12 by default, so it shows a reading every hour.  

All these separate systems, apps and scripts connect through a mini router I got for $35 that's powered by USB.  This enables me to take the E-Ink pi and the mini router, power them both up off a USB battery Bank and wait about 2 min for the Units to boot and the Sensor Units to auto connect to WiFi, and I can then pull data remotely from the units, up to however far the router's and pi's range are (50-100 meters?).  Great for putting Sensors on tree's, in water, down a hole, etc, etc.  

I also enabled a OpenVPN server on the router itself, allowing me to connect through the internet and grab the sensor data with my PC program.  This can be done, even from remote sites through 3G or 4G connectivity (AKA cell phone service). Simply add a USB dongle for 3G / 4G to the router, and BAM, I can suddenly connect a lot of units, within a decent range to the internet for remote monitoring and maintenance!  

That's pretty much were I am at now.  I'm also working on other aspects like Pi Cases for weather proofing or even water and underwater deployment.  High altitude balloons are also in the future.  

I think that about does it for this post.  I'll eventually post my Python code too, but I wanted to clean it up and add some comments to explain things first (being my first Python project and all). 

 

 

A Raspberry Pi 3B+ Python Project!

I now have a use for this domain 🙂  My Python + Raspberry Pi development. 

So, about a month ago, I got a few raspberry pi 3B+ with 2x senseHAT's.  Long story short, the senseHAT is an attachment that is loaded with sensors, a 5 'button' joystick and 8×8 LED grid.  By making your own programs, you can access the hardware and get readings or have the LED's light up in any way you like, including animations.  

The raspberry pi peaked my interest for a few reasons.  

1.  They are pretty cheap at about $50 Canadian.

2.  They are small and power efficient.  AKA I can power them for a long time (few days) off a USB battery bank.  

3.  Decent support to help learn programming.  Check out their website www.raspberrypi.org

However, I was more interested in what kind of environmental data I could digitize through the sensors.  AKA more accurate local weather type information.  Before I could start however, I needed to think of how I could get and store information from the sensors and ways I could manipulate that data to find cool patterns (like when its the coldest time of day, and how and when that changes over days, months, years, etc).  

I have tried a few times to learn programing (C++, Java), but ultimately failed the self taught way, due to a lack of direction to assist with learning (AKA motivation).  But now, for about $150, I can get the pi + senseHAT to do a lot! 

I have actually come pretty far already considering I only got them a month ago, but I'll post about that later.  

This site will be active! 

w00t!

New Year!

Well, it's another new year.  Not a lot has gone on, my sites have stayed infection free (yay!), I have been learning more about Microsoft Server 2012 / 2016, as well as PowerShell.  Pretty neat stuff for some, rather dry for others, but its important to keep learning.  

I have purchased a few YubiKeys.  They work pretty well, and can provide two factor authentication natively for things like Google, Last pass and even Facebook!  

Guess I'll post later when I think of something interesting to post… 

Site Infected!

So I just moved from one GoDaddy host to another GoDaddy host, as they told me the server I was on, was out of date and could not be updated beyond PHP 5.4 (and probably other OS components…).  Any who, during this move, my buddy messages me saying my site has been hacked, but it looks fine when I go to the site directly. 

Long story short, some how some one got in and modified my .htaccess file in the root dir.  It checked to see if people came to the site from a search engine.  if so, it changed a lot of text to say things like "Viagra".  

Edited the .htaccess and all is good, but pretty sneaky stuff, as most website scanners did not even pick up the hack.  

Nothing new?

Its been about a year, better put an update out… hmm lets see… to all my 0 fans out there, nothing new to report.  I put Ubuntu on my main home computer, since its really easy to get some games (Steam) and netflix to work (Chrome).  No dual boot for me, pure Ubuntu 14.04 and a windows VM.  So far so good.  

 

 

Random Update

Once again its been awhile since posting here.  I have been pretty busy as of late, with a decent amount of work coming in, but also the family side is taking a lot more of my time, thanks to the wife working more then me! 

Let see, Ubuntu 14.04 will be out in a matter of weeks! So that's pretty exciting.  They are brining in a few nice updates, such as allowing local menus again (not all the file menu's at the very top, but in each app if you desire).  Its a setting you can enable in the settings panel.  They have also improved the scaling for super HD monitors, such as the 4k displays.  The kernel will also be 3.13 with a already back port from 3.14 for the new intel graphics support.  So I'm fairly excited about this LTS release.  Things we will NOT see for a fairly long time is the Mir display server, as its not up to spec yet, which is a bit disapointing, but understandable, as that's something you want rock solid!  Due mostly because of all the contraversy, I kinda wish Canonical would just go back to making Wayland their target but o well (I just hate seeing a big divide in use of a main OS subsystem).  

In other news, SteamOS is coming along nicely and thanks largely to SteamOS, the 3 main Video card makers seem to be picking up the slack for improving the Open Source Drivers for their video cards!  Nvidia is not doing a heck of a lot for older cards, but they seem to be doing a fair bit of work for their SoC Tegra graphics support.  They will also hopfully open up more documentation along the way to help out the open source driver.  SteamOS is also using Debian as their main OS instead of Ubuntu (As I think I mentioned before).  If the Open Source drivers keep inproving, I may give straight Debian a try instead of Ubuntu.  

 

Ubuntu hate (not me)

Ubuntu seems to always get a lot of hate for things they do, but I think a lot of it is unjustified. Granted, I would like to see Canonical use more standard directions, like Wayland instead of Mir (especially since they were the ones who started going with Wayland), but I'm sure they have their reasons, and if I remember correctly, one of the main reasons was to get android drivers working with it for quick deployment.

That being said, I think they are doing a lot more good then harm. Their biggest achievement I think has always been getting Linux as a desktop platform into the publics eyes. Also the only “harm” people seem to complain about, is either

A) putting in non-open source things like driver blobs

and

B) making their own software instead of using something already out there

 

For the first part, yes I would like to see more Open source drivers out there, but Canonical made it so Ubuntu runs on WAY more systems, and better! This is a plus for the user, and once things get rolling with Linux being more main stream, I'm sure companies will start putting more time into making better open source drivers for their hardware (Nvidia is now putting out documentation so a better Open Source driver can be made, partly thanks to Steam making SteamOS and maybe partly because of Linus fingering them…).

For Canonical making their own software instead of using things already out there, who cares? I know of only really 2 things they have made them selves and people have complained about, and that is Unity (user interface) and Mir (instead of wayland). In the case of Unity, simply install another user interface…. its not hard, there are loads of documents on the web to help you as well, should the software center not have it (but I'm fairly sure the software center does indeed have all the major ones) or you want a updated version. As far as Mir is concerned, I don't see the big issue, for one a lot of people are comparing it to how it runs right now… which is in a alpha state, so it will get much better, and 2 all the side distro's that REALLY don't want to use mir, could just create the distro with something else, granted it would be more work, but it's possible.

 

Another thing you have to keep in mind, is that Canonical is pushing the boundaries of Linux/GNU to get to places that it would otherwise be really hard to get to. Like the phone. It took a HUGE company google to get Linux as the base of their android OS and that is ONLY the kernel. Canonical is trying to get Linux/GNU as a whole out there, and they are going to have to do things differently in order to push it out in time and be able to stay on top of things to make sure their product functions as it should. Right now they need the driver blobs and Mir to get the whole convergence thing, and that's fine. I for one applaud them for making the hard calls to advance Ubuntu in to areas that would other wise be just a dream.

 

Linux/GNU is MUCH better with Canonical then without. When Open source software and Linux becomes more of a norm in all area's of computing, I have no doubt Canonical / Ubuntu will be a big reason why!

1PB of optical storage!

Dang, that's a lot of space.  Wonder how long it would take to burn 1PB of data 😛  Still would be very useful for backups.

Read article here

The Wayland Situation: Facts About X vs. Wayland

This clears some things up. It also makes me excited about Wayland… not sure how it ties in with Canonical's Mir though… Any who, graphics in general are a weak point in Linux, and its nice to see this side of things being cleaned up. Now to get better Graphics drivers! Wonder if it will be easier for display drivers to be make for wayland vs X?

Wayland Situation