I just received a raspberry pi 3 B+ this week that I ordered from Newark. I am using it to build another battery capacity test data acquisition + analyzer. I love the pi’s SD card copier accessory. I used it to burn an exact copy of the image I have on a working analyzer to a fresh 8GB SD card. This is particularly useful on this project because I have so many special packages, file systems, daemons, and configuration options set up on this pi, and wanted an exact copy. The one I copied it from was running on a pi 3. I put the SD card into my new pi 3 B+ and fired it up.
The power LED had a regular blinking pattern; three short, four long – if I remember correctly. At first I thought I had a bad pi out of the box. I then began to suspect the SD card. It was the cheapest class 10 SD card I could find on Newark. I put it into a pi 2 and it booted up just fine, so that wasn’t it. Lo, and behold the pi 3 B+ will not run on raspbian jessie; it must be stretch running linux kernel 4.1.
I downloaded the latest version of raspbian stretch, reformatted my SD card to a FAT file system, and used etcher to burn the image to the card. Put it in, fired it up, and bam! It started up just fine. Bad thing is I will have to manually configure everything from scratch.
goaccess has already paid off for me. I have been checking it daily since I installed it and noticed that my most requested page was xmlrpc.php. Tons of data was being POSTed to it. After a quick search, I came across a tutorial for a brute-force attack to login to a wordpress site.
I immediately logged into my VPS and renamed my xmlrpc.php file, and the attacks stopped. Thanks, goaccess.
Back when I was a freelance web designer, I hosted most of my sites via a reseller account I had with Hostgator. I was really pleased with the service. They used cPanel, which in my opinion is very feature rich and easy to use. It is the next best thing to a VPS. Hostgator also provided the all-important awstats traffic analyzer. I still think awstats is an extremely good access log analyzer, parsing the log in every conceivable way and producing easy to understand graphs.
Setting up awstats on a server can be a pain, especially if you have several virtual hosts. I just wanted something simple to check the traffic for this blog. After contemplating writing my own analyzer, I decided to go with goaccess. I followed this tutorial on digitalocean, and I am very pleased so far.
I manually went through parts of the access log, and obviously I have some bots from an ip address in hong kong trying to post bogus data to scripts that dont exist. They didn’t get anything.
goaccess does just about everything I am interested in: top pages, bandwidth, OS, browser, and referrers. I highly recommend it.
I got a ring doorbell for Christmas. It was a very thoughtful gift and I gotta admit it is very slick. However, for some time, I have been using a home made security system based on the raspberry pi zero w and perl.
I designed it so that each node sends udp messages to a udp + LAMP server. I can view all the events on the server’s web interface.
The front-door node also has a TMP36 temperature sensor read by an MCP3008 adc, and a raspberry pi camera. When the door is opened, it takes a picture two seconds later, and uploads it to the LAMP server.
I set up port forwarding on my ISP router so I can view my LAMP server from anywhere.
The udp client and server scripts are incredibly simple.
I go into somewhat more detail on my hackster account. Off-the-shelf home security and automation products are fairly inexpensive and easy to set up nowadays, but for me, it’s just so much fun to build my own from scratch.
Still working on the maker space and expanding my networking lab. I added a cisco 1721 router with a 10-base T wan interface card and a serial 1T WIC in addition to the built-in fast ethernet interface. I also added an old cisco 2514 with two built-in AUI (ethernet) interfaces and two serial interfaces.
The computer at my work bench doesn’t have a serial interface that I can connect to the routers’ console interfaces, and I was too lazy to go get my usb to serial converter out of my van; especially when I had my pine64 nearby with an rs-232 to TTL converter. I fired up my pine64 and connected the rs-232 to TTL converter to the UART pins on the pi-2-bus. The converter and the console port of the routers are both DTE devices, so a null-modem (serial crossover) cable / adapter are necessary. I hooked it all up like so:
Here you can see I have my pine64 connected to a cisco console cable via a null modem adapter and a gender changer. First I had to ssh into the pine. Now to install screen on my pine64.
Since the new year, I have been working on setting up a maker space in my garage. It’s coming along pretty good. I set up some lights and receptacles on my existing utility counter top, and extended my wired network to a wall-mounted rack where I have some of my networking lab already installed.
While organizing my tools and components, I came across a bunch of different IC’s that I didn’t know I had like the 74LS109AJ dual J-K-not flip-flop.
These can be very useful for a number of applications. Back in school, I used several of these in tandem to increment memory addresses in EEPROM’s. Here is a small example of such a circuit using the 555 timer circuit I recently built.
Basically, I wired up the IC to toggle. I used the output of the 555 astable multivibrator circuit as clk input to filp-flop one, and then had Q1 as input to flip-flop two. It basically divides the frequency of the 555 twice.
The MCP3208 12-bit analog-to-digitial converter is the basis of my battery load test analyzer and online monitoring system which I call pid3A . As I have mentioned before, I implemented a bit-banged SPI driver for the mcp3208 in the perl programming language. I use the analog-to-digital converters (adc’s) to sample the voltages of each cell in the battery plant at regular intervals to make graphs of the discharge curves.
pid3A is in it’s 2nd prototype and can accurately measure up to 24 cell voltages at a time with it’s three 8-channel mcp3208’s. Occasionally, I will burn up a single channel on one of the adc’s, rendering the whole chip useless for my application.
I have written a lot of diagnostic software for pid3A to make sure the adc’s are functioning properly before I begin an IEEE450 load test. To test all 24 channels, I made a test plug that puts 2.5VDC on each channel, takes 5 samples, and give the the binary output code and actual voltage of each sample. It then gives me a color-coded go/no-go visual indication. If there are any bad channels, I just change out the adc chip and re-run the diagnostic test.
Here is a sample of the output:
You can see that the adc output codes and voltages are very steady. The voltage is a function of the digital output code of the adc. Above, most of the output codes are 2049. Knowing this, and the reference voltage of 4.998VDC, you can calculate the actual voltage using this equation:
This is absolutely necessary for troubleshooting quickly, but sometimes I need to know what is going on at a microscopic level. My multi-channel logic analyzer is the perfect tool to look at the underlying SPI protocol.
I know this just looks like a mess of wires, but I have my logic analyzer hooked up to the data-in, data-out, chip select, and clock lines of one of my mcp3208 chips. Here is a close up of a frame from my diagnostic script:
This shows the driver clocking in 19 pulses. The first few bits on the MOSI line tell the adc to use single (as opposed to differential) mode, and sample channel 001. The rest of the MOSI bits are ‘don’t care’ bits, so my driver just set them all high. The MISO line is the mcp3208 clocking out the actual binary output code. In this case it is 2045, which in binary is 011111111101. The slave select line goes low to initiate a sample, and goes high when finished. PulseView shows me precisely what is happening, and lets me easily analyze the SPI protocol for proper function per the datasheet below:
I downloaded a copy of the AppImage forPulseView at Sigrok.org. With this setup, I have an amazing multi-channel oscilloscope right on my computer for just a few dollars.
I have three examples to show some of it’s capability based on some of my recent posts
an example of a bit-banged SPI driver I wrote for a MAX7219 7-segment display driver
the output of the 555 timer circuit I built in a recent post
the I2C sda and scl lines of the MCP23008 perl-based gpio extender driver I wrote.
Here is the setup I have for the MAX7219 display driver.
I am using my new pine64 to drive the display. The datasheet for the max7219 describes in detail how to operate the chip like how to configure the driver via control registers and the data format. Below is the expected data format per the datasheet:
I connected my logic analyzer to the MOSI, CLK, and slave select lines and here is the output in PulseView.
You can see on the slave select line, I go high and low and then bang in 16 pulses on the clock line. The data is on the MOSI (master out, slave in) line and tells the driver which LED’s to turn on. This is awesome for troubleshooting problems with digital circuits. What is really cool is PulseView’s ability to decode SPI. The bottom line show the content of the frames in hex and binary.
One thing I find interesting with my perl based, bit-bang driver is that the clock pulses are irregular in their duty cycle. This is easy to see if you zoom in on the clock line.
Each dot on the square wave represents a sample pulseview took.
Now for the output of the 555 astable multi-vibrator circuit I recently blogged about. These were the parameters of my circuit.
And here is what PulseView saw.
The calculator says 4.3Hz and a 52.38% duty cycle. That is pretty much what PulseView said. The output of the 555 timer is very precise and regular.
Finally, lets take a look at an I2C example using my MCP23008 driver from the binary counter example I recently blogged about. Well, this is the first scan with the logic analyzer that I am actually using the device’s hardware, in this case I2C. That being the case, it is much faster than my bit-bang SPI example, and certainly the 4.3Hz 555 circuit. At first glance, it doesn’t look like much. I did tell PulseView what protocol I was using, and which lines were sda and scl.
You just see some periodic blips on the lines, but the frames are accurately decoded. You have to zoom in to see what precisely is going on with the pulses.
Above is a blown up view of one of the blips from the complete trace above.
Every maker should have a logic analyzer for development and troubleshooting, and I highly recommend the HiLetgo analyzer I use.
Automatic dependent surveillance—broadcast (ADS–B) is a surveillance technology in which an aircraft determines its position via satellite navigation and periodically broadcasts it, enabling it to be tracked.
It’s really easy and fun to see what planes are flying near you with a software-defined-radio dongle and dump1090.
After installing dump1090, you can see nearby aircraft information like the flight number, altitude, lat/lon, and speed. Here’s what I saw one afternoon near Memphis, TN:
./dump1090 --net --interactive
After just a few seconds on starting dump1090, planes start to appear. To view this information on a map, launch a browser and go to localhost port 8080.
It even provides links to FlightAware, so you can see even more information about a particular flight.
I have been a Christian since I was 12. I began reading the Bible for myself at 13. I became more serious in my study at 20, and have been diligently studying ever since. I enjoy it tremendously. I really try to meditate on what I am studying; try to imagine what it must have been like for the people involved; try to understand why a certain passage is in the Bible and it’s true meaning; is there something in between the lines I can deduct? Along those lines, I like to hear what other people think about it. Those with whose theology I agree with, and those I do not. Those who reject it all together, and why they think that way.
I also read several Bible commentaries as I study. There are so many of them out there. Most of which, I have no interest in. There is also so much software and Bible study websites out there that it can be bewildering. I decided that I wanted to make my own Bible study website that suits me, and only contains the resources that I am interested in.
When I decided undertake this project several years ago, I had a successful free-lance website business called Nerd for Hire. I was building and hosting custom designed PHP web applications, primarily serving real estate industry and used car lots in the greater Memphis, TN area. I was focused on PHP/MySQL, the then new jQuery, AJAX, CSS, etc., and hosting it all on a reseller account I had with Host Gator. It was a nice side gig until Craigslist started charging $5 for dealers to post cars on their site. Craigslist was essential for directing traffic to the dealer’s website where the whole inventory could be advertised. I briefly moved over to backpage.com, but it just wasn’t the same. Increasingly, my customers wanted incredible, custom-made web applications (my specialty), but didn’t want to pay much for them. It became to much effort for too little financial reward, and I ended up folding.
This was around 2010. Perl was unfashionable at this time, and perl/CGI was certainly not the tool of choice for web applications anymore as fast as PHP had gotten. Never one to go along with fads, I had been reading an entry-level perl book that was 8 years old at the time (got it for $0.01 + $3.99 shipping on Amazon), and I was VERY interested in learning perl because it seemed like it could do everything: text processing, databases, windows applications, server side scripting, etc.
I figure the best way to learn a new language is to do a big project in it. I proceeded to write a CGI application in perl to read the King James Version Bible. Am I KJV only? No. Is it my favorite? Pretty much. I forget where I found a SQL file of the KJV bible, but I did, and imported it into my home LAMP server via phpmyadmin. I then wrote an object oriented CGI application to read the Bible on my home network. I purposefully ignored any css styling, and just wanted a simple, stripped down design. I began using it daily during my study, being really pleased with myself for having got that far.
I was using Power Bible CD at the time, and had really taken a liking to the Adam Clarke Bible Commentary. I wanted to add it to my little project so I didn’t have to go between applications during my study. I created a database schema and manually copied and pasted every single chapter of the Adam Clarke Commentary from studylight.org. It was tedious, and painful, but it worked. Once I had it in database form, I added scripting so that the commentary was displayed side by side with the chapter in the Bible I was reading. Soon after, I added the Joseph Benson Commentary in the same inefficient fashion.
After some time, I discovered the Internet Sacred Text Archive, www.sacred-texts.com, which contained numerous Bible commentaries and other interesting resources. I got a little more sophisticated, and wrote scripts (wget + perl) to automatically download the commentaries chapter by chapter and save them as text files on my computer. I then wrote scripts that merged them all together into a csv file, and imported them into a MySQL database. I did the same with a few Bible dictionaries, encyclopedias, etc. from the Internet Archive. I was getting pretty good with perl’s regular expressions and amazed at how easy it was to do really powerful things in perl with such little effort.
So, I got my CGI application together the way I wanted it, and was still just using it on my internal LAMP server. I had recently started renting a VPS from digitalocean.com for a for-sale-by-owner real estate project. I decided to put my humble project on the internet, since I already had the hosting resources. I decided to go with a free domain: www.kjvbible.tk. I am still hosing it on a VPS from digitalocean. Other sites I am hosting there are using PHP 7. PHP is smoking fast, and comes with OPcache standard. On the other hand, perl CGI is an anachronism, SUPER DUPER slow, and taxing on the CPU. I really don’t care though. It’s out there for the world to see. Ad-free and just a simple, easy-to-use place to study the Bible.