Friday, October 20, 2017

To do this weekend.


Out of Micro sd cards so it is time to get a few more.  Finally have my rpi 0 w to play with. Finally have Pimoroni hammer headers. They do not come with instructions, but that was finally figured out.  Nice they gave you a choice of either female or male headers.




Also have the speaker bonnets, but they do not come with speakers so the ad is misleading,

Only have a few atmel368 chips left. Have a project or two for them.

Have the rpi zero w teathered to my nexus 7 2012. Will show you the steps soon.

Friday, May 12, 2017

Odd monitors for the Raspberry Pi.

If you do not have access to hdmi based monitors, any old monitor with composite input used with the old eight bit computers should do fine. You may have to purchase a special cabIe. I like to use my old c=1701. You can even add a digital tuner and use it as a tv.



Some old TV's that do not have composite but do have rf input can be used with a vcr



My favorite is to use an old dvdrom player with composite and audio input. You can always attach a Raspberry Pi to the back of the unit to make it super portable.



Even an old portable tv with composite input can be a choice! In the case though it is only black and white.


Then again you can use your tablet via xrdp to act as a screen for your raspberry Pi.


Last but not least is the old Trs-80 monitor. No sound and is only black and white. You also have to provide a +5 volts line externally..



There is always those inexpensive mini portable monitors, but they may require 12 volts to work. Normally used for automobiles.


Note: for the Raspberry Pi Zero will require adding solder points for the composite output and an audio filter. The specs for this are in an earlier article.

Monday, April 17, 2017

Starting slackware 14.2 in a virtual machine.

Started with Slackware linux and decided to go back and look at it.  In this case, I plan to use qemu to build a virtual machine. You will need to have a stable internet access for this project. You also need to have a fast machine with over a gig of memory.  You will not need to download and burn a cd or dvd.  You will need a floppy, usb, cd, or a network interface card that supports gpxe (ipxe).



You will want to go to romomatic,net to build your image to put on your boot device. Though with Qemu you can just use the image without creating boot media,  Though I do recommend using 256 megabytes of ram. Be sure to set up the virtual drive for your install.


Once you have everything the way you want then you can launch the install.




Eventually you will get to a login and the you can start the the good old install;


AAh, at home again.

-------------------------------------------------------------------------------------------------------
Slackware pxeboot script:

 #!ipx.e
dhcp any
initrd http://slackware.cs.utah.edu/pub/slackware/slackware-14.2/isolinux/initrd.img
chain  http://slackware.cs.utah.edu/pub/slackware/slackware-14.2/kernels/hugesmp.s/bzImage load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 nomodeset SLACK_KERNEL=huge.s

Motioneyeos.

Normally I am not fond of canned software, but this one might be an exception. Motioneyeos is a raspberry pi implementation for the program Motion. Motion is software to control video capture devices. All control is done via the web. For purposes of this project we used an original raspberry pi. (https://github.com/ccrisan/motioneyeos/releases). There are several releases depending on the unit you have.



First I tried a logitech usb camera clone. The system recognized it immediately. Not like a certain other operating system where you have to load the drivers for almost everything.


Then we added an ipcamera (network ready). After adding the network camera file, it worked just like you would expect. The documentation for the camera the did not have the description of the file. Fortunately the Motion software site did have that information.  (http://www.lavrsen.dk/foswiki/bin/view/Motion/WorkingDevices) Again no additional drivers were required.


Actual picture is much clearer. For a novice user it is pretty simple. Only exception is shutting the unit down, I did not see a visible icon. Also security could be greater, but for the price of free you can not beat it.

installing motion from scratch:

Let's get your system up to date (might take a while if you have not updated very recently).

$ sudo apt-get update ; sudo apt-get upgrade
$ sudo apt-get dist-upgrade

Now let's install Motion

$ sudo apt-get install motion.

Does the RPi see your camera?  (aka list usb devices attached.)

$ lsusb

...
Bus 001 Device 004: ID 046d:08a9 Logitech, Inc. Notebook Deluxe
...

if not, you may need to get a more mainstream camera. usually Logitech sets the standard. I just used a cheap refurbished knickoff. Your output will vary..

Do a liittle configuration:

$ sudo nano /etc/motion/motion.conf
In here there are a few basic changes that you need to perform:
  • Daemon = OFF to ON
  • webcam_localhost = ON to OFF
You can change other settings but it’s recommend you don’t take more than 2 frames, and you been the default frame pixel size, for stability.

To ensure that the motion service will actually start as a daemon we need to change another configuration setting, so enter the following:

sudo nano /etc/default/motion

Then change the value “start_motion_daemon=no” to “yes”


Let's get started:

Finally you can start the motion service to stream the web cam images

sudo service motion start
Then after about 30 seconds browse to the new web interface, which should be at the below URL (where 192.168.0.100 is your Raspberry PI’s IP address yours may vary)

http://192.168.0.100:8081

Hint: if you do not have direct access to your RPi, you can use https://www.instructables.com/id/Red-October-network-discovery/ to find iit on the network Frequently I will hook up the RPi to the network without a keyboard, mouse, or monitor and then remote into the unit,

Also:

Note if you want to use an ipcamera it is easy but you have to know about the camera. I ended up going to the zoneminder wiki and found the answer for my camera. Setup is the same, but you have to add two lines to motion.conf.

 netcam_url http://19.168.10.85/videostreadlocationsomekindof.cgi
 netcam_userpass user:password

For us  it was:

 netcam_url http://192.168.10.85/video.cgi
 netcam_userpass user:password

I have ZM installed on my Media Server that runs multiple programs including Apache, email server, and Mysql with no issues. I dont know if the earlier stages of Zm was picky like that but its more friendly now neat! do this to my room!
Cool. I also thought of maybe using this for a pod casting setup also.
Awesome. I was easily able to set up a video surveillance system at home and at work.
There are also instructions for installing form source:

Sunday, April 9, 2017

Basic pi setup.

 

Basic setup

-----------------

install jessie os
do updates
install vim mc


Wifi
------

Check Ethernet & Wifi Before continuing make sure the Ethernet cable is connected in and you can ping out from the Pi:

ping 8.8.8.8

You will also want to set up your WiFi dongle. run

sudo shutdown -h

now and then plug in the WiFi module when the Pi is off so you don't cause a power surge.

If you have a Pi 3, or any other Pi with built in WiFi, an external WiFi adapter is not required but you can use one if you need a bigger/external antenna.  When it comes back up check with ifconfig -a that you see wlan0 - the WiFi module.


Install software
-----------------

Next up we install the software onto the Pi that will act as the 'hostap' (host access point). You need internet access for this step so make sure that Ethernet connection is up!

sudo apt-get update
sudo apt-get install hostapd isc-dhcp-server

(You may need to sudo apt-get update if the Pi can't seem to get to the apt-get

repositories) (text above shows udhcpd but that doesnt work as well as isc-dhcp-server, still, the output should look similar) Also install a nice iptables manager with

sudo apt-get install iptables-persistent

You'll get two 'config' screens, say Yes to both


Set up DHCP server

Next we will edit /etc/dhcp/dhcpd.conf, a file that sets up our DHCP server - this allows wifi connections to automatically get IP addresses, DNS, etc. Run this command to edit the file

sudo nano /etc/dhcp/dhcpd.conf

Find the lines that say

option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;

and change them to add a # in the beginning so they say

#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;

Find the lines that say

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

and remove the # so it says

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

Then scroll down to the bottom and add the following lines

subnet 192.168.42.0 netmask 255.255.255.0 {
range 192.168.42.10 192.168.42.50;
option broadcast-address 192.168.42.255;
option routers 192.168.42.1;
default-lease-time 600;
max-lease-time 7200;
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
}

Save the file by typing in Control-X then Y then return  Run

sudo nano /etc/default/isc-dhcp-server

and scroll down to

INTERFACES=""

and update it to say

INTERFACES="wlan0"

Or whatever the name of your wifi adapter is! close and save the file  Set up wlan0 for static IP If you happen to have wlan0 active because you set it up,  run

sudo ifdown wlan0

There's no harm in running it if you're not sure Next we will set up the wlan0 connection to be static and incoming. Run

sudo nano /etc/network/interfaces to edit the file

Find the line auto wlan0 and add a # in front of the line, and in front of every line afterwards. If you don't have that line, just make sure it looks like the screenshot below in the end! Basically just remove any old wlan0 configuration settings, we'll be changing them up Depending on your existing setup/distribution there might be more or less text and it may vary a little bit  Add the lines


iface wlan0 inet static
address 192.168.42.1
netmask 255.255.255.0

After allow-hotplug wlan0 - see below for an example of what it should look like. Any

other lines afterwards should have a # in front to disable them Save the file (Control-X Y ) Assign a static IP address to the wifi adapter by running

sudo ifconfig wlan0 192.168.42.1

Configure Access Point

Now we can configure the access point details. We will set up a password-protected

network so only people with the password can connect. Create a new file by running

sudo nano /etc/hostapd/hostapd.conf

Paste the following in, you can change the text afterssid= to another name, that will be the network broadcast name. The password can be changed with the text after

wpa_passphrase=

interface=wlan0

driver=rtl871xdrv

ssid=Pi_AP

country_code=US

hw_mode=g

channel=6

macaddr_acl=0

auth_algs=1

ignore_broadcast_ssid=0

wpa=2

wpa_passphrase=Raspberry

wpa_key_mgmt=WPA-PSK

wpa_pairwise=CCMP

wpa_group_rekey=86400

ieee80211n=1

wme_enabled=1


If you are not using the Adafruit wifi adapters, you may have to change the

driver=rtl871xdrv to say driver=nl80211 or something If you are using the Raspberry Pi 3's internal WiFi adapter, comment out thedriver=rtl871xdrv

 line altogether: Save as usual. Make sure each line has no extra spaces or tabs at the end or beginning - this file is pretty picky!  Now we will tell the Pi where to find this configuration file. Run

sudo nano /etc/default/hostapd


Find the line #DAEMON_CONF="" and edit it so it says


DAEMON_CONF="/etc/hostapd/hostapd.conf"


Don't forget to remove the # in front to activate it!

Then save the file

Likewise, run


sudo nano /etc/init.d/hostapd

and find the line


DAEMON_CONF=


and change it to


DAEMON_CONF=/etc/hostapd/hostapd.conf


Configure Network Address Translation Setting up NAT will allow multiple clients to connect to the WiFi and have all the data 'tunneled' through the single Ethernet IP. (But you should do it even if only one client is going to connect) Run

sudo nano /etc/sysctl.conf

Scroll to the bottom and add

net.ipv4.ip_forward=1

on a new line. Save the file. This will start IP forwarding on boot up Also run

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward "

to activate it immediately  Run the following commands to create the network translation between the ethernet port  eth0 and the wifi port wlan0


sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT

sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT


You can check to see whats in the tables with


sudo iptables -t nat -S

sudo iptables -S


To make this happen on reboot (so you don't have to type it every time) run


sudo sh -c "iptables-save > /etc/iptables/rules.v4"


The iptables-persistent tool you installed at the beginning will automagically reload the configuration on boot for you. update hostapd (maybe) If you are running Raspberry pi kernel 4.4.13-v7+ or greater (check your kernel version with uname -a), you do not need to do this step. if you are using the Raspberry Pi 3 built-in WiFi or are not using RTL8192-like WiFiadapter, then skip this step! before we can run the access point software, we have to update it to a version that supports the WiFi adapter. First get the new version by typing in


wget http://adafruit-download.s3.amazonaws.com/adafruit_hostapd_14128

Then install it.

Apache2 web server and php:
----------------------------

sudo apt-get install apache2 -y

sudo apt-get install php5 libapache2-mod-php5 -y


Database:
---------------

Install MariaDB on Raspbian


With the new version of Raspbian, MariaDB is now present in the official repositories, which until now was not the case! To install it, nothing more simple therefore, you just need to run the following command:

sudo apt-get install mariadb-server

If you already have MySQL installed, it is likely that the package manager notifies you of a conflict and asks if it needs to uninstall MySQL. In this case, answer yes. During the installation, MariaDB will configure itself. It’s up to you to provide the administrator account for the database.  This done, it should ask you if you are sure to want to go under MariaDB. Again, answer yes. Once the installation is complete, you will be able to access MariaDB as you did with MySQL, simply with the following command:

mysql -u user -p


Setup gui
-------------

sudo apt-get install xinit

sudo apt-get install lxde-core lxterminal lxappearance

sudo apt-get install lightdm

sudo reboot

Web database admin
-----------------------------

sudo apt-get install phpmyadmin

Add your own passwords

Remote desktop
-----------------------

sudo apt-get install xrdp

Bluetooth
--------------

Make sure system sees the bluetooth device

    lsusb

upgrade the system software:

    sudo apt-get update
    sudo apt-get upgrade

Install the bluetooth software:

sudo apt-get install bluetooth blueman bluez python-gobject python-gobject-2

Open a Terminal window and edit the /etc/rc.local file with:

    sudo nano /etc/rc.local

And add the following to the end of the file, just before the exit 0 line:

    sudo hidd -i hci0 --connect 00:07:61:B4:7E:81

replacing the MAC address with the MAC address of your keyboard or computer.

Tuesday, March 7, 2017

Old vcr ir sensor.


An old fashion vcr can be a treasure trove of re-usable spare parts for electronic and robotics. Although they are quickly disappearing, you can still find them in a few thrift stores.



In this case, I rescued the vcr channel ir sensor. Also added extension wires  for use with a breadboard. There is a ton of code out there, but the connections setup is the most vital. There are three basic connections of data, plus, and minus, You will probably have to do a web lookup to get the pinout of the ir sensor.

Then look for the circuit that applies.


http://playground.arduino.cc/Main/PanasonicIrSensor

Lcd pixel fix.


Fixing a bad pixel on some lcd monitors is as easy as using a ball point pen. Be gentle and do not puncture the screen. Then rub the screen with a cloth to restore the screen.