Sunday, December 27, 2015

A list of ADC Raspberry pi Hats / add-on modules. I will be doing another list of modules that are not hats but can be connected to the pi.

First a breakdown of what resolution and/or sample size mean. If you see 8 bit, 10 bit, 12 bit etc you can find out the amount of samples by 2^(bits). so 8 bit would be 2^8 = 256 samples. So if you have 0 - 4.096v inputs and you are reading and you are reading wind speed 0-100kph.
4.096v = 20 m/s and
0 = 0 m/s (even if the threshold on making the anemometer spin is 0.5m/s)
so if the wind is blowing at 10m/s you would have an analog value of 128
you can take this equation ((20-0)*125/256)+0.

Keep in mind that higher might be better but not always. It depends on noise, sensor quality and other factors.

Sadly the list below yields nothing less than $10 for an add-on module.. If you wanted to use the PiZero and a module it wouldn't be cost efficient. Maybe a reader can help kickstart some simple cheap one purpose pi-zero hats such as an ADC for iot. This left me to try other options possible a esp8266 (has a single 10bit analog input) or a Photon (~$20 and has 8 Analog inputs 12 bit). There are some none add on modules that are i2c/spi connectable if you don't care to engineer your own enclosure/setup.

Friday, November 27, 2015

Since I'm in the United States I was able to celebrate Thanksgiving. One of my favorite parts of this day is eating pie. Over the last couple weeks I've been comparing streaming algorithms that output Pi(the number) as it's calculated. One handy python library I found was the PiDigits Library. I was amazed at how well it did. I also (through a lot of googling) found a couple more variations of those pi algorithms. Of course I wanted to find the fastest. I hopefully try to optimize it with the gmpy python library which handles very large numbers better.

Graph of 20,000 digits of before mpz and after (on a non overclocked Raspberry Pi 2):

You can see that adding mpz (from the gmpy python library) increased digit output by over double.

Lamberts and Gospers seemed really close so I did a calc to 100,000 digits normal CPU speed and overclocked to 1ghz.

Looks better right :-)

I then looked at my CPU and noticed it was only using one of the 4 Cores that the Pi 2 has :-(.

I doing my research on seeing if this can be split into multiple processes. But so far my attempts have been unsuccessful. Maybe a reader(much smarter then myself) can help enlighten me on this quest. Please comment and share.

Sunday, November 15, 2015

I've found some very useful tools to help me program on my Raspberry Pis. Most all of which are not connected to screens, unless you count the Picture Frame Pi which is on the wall and would be impractical to connect a mouse and keyboard to and start coding. Here are the tools I use for Mac and PC operating systems.

IDE

PyCharm Community Edition

PyCharm is Available for Linux,Mac, and Windows environments. With the next tool you can mount your Raspberry Pi's as a network volume using sshfs or winscp (Window's)

Mounting your Pi on Mac

Here there are a couple of options. Installing and setting up a samba share or use the currently built in features of ssh and scp. I decided to go the ssh route and used the following tools for that on my Mac

First you need to install Macfusion. Macfusion allows you to mount various filesystems on your Mac including network filesystems with a couple plug-ins. Without installing samba on your raspberry pi you can mount your filesystem using the sshfs plugin. Notice in the link to install the dependencies before installing Macfusion.

Mounting your Pi on Windows

There's also a couple options but again if you don't have samba setup and don't want to go through the hassle you can do the sshfs or scp mount in windows as well with a couple tools:

A great post for mounting is found here: SSHFS For Windows. This makes the sshfs share appear as a mounted network drive.

Another way is to use WINSCP. You are able to browse through your Pi's filesystem and modify, copy, move, and delete files. If you go to your settings within winSCP you can modify the editors for each filetype. You will want to choose PyCharm for your .py extension filetype. When you edit a file from winSCP it creates a temporary file in a temporary directory within windows. It then checks for file changes and syncs it back to the pi (or whichever ssh file system you mounted).

Mounting your Pi on Ubuntu/Debian

Since Ubuntu and Debian are similar you can follow the basic procedure here. You can mount using the "Connect to Server" tool for mounting the SSHFS.

Opening your project

After mounting you can open a current python project folder or create a new one. Since I'm on my Mac you'll see the open dialog screen similar to that.