Chit chat

======

Grep:

$ grep -l -e “searchterm” *just get the file names

Use sudo without having to retype the command

updatedsudo

Got a bunch off goodies to play with for the Arduino. wifi, ethernet, and ping sensors.

We recommend not using companies that are removing confederate merchandise from their shelves.

Screenshot from 2015-06-25 17:30:17

Basis for a new project ust a touchpad plus an rpi.

Screenshot from 2015-06-28 15:19:57

—————————————-

Cartoons:

Screenshot from 2015-06-29 00:49:13

Screenshot from 2015-06-29 00:12:01

Screenshot from 2015-06-28 23:38:19

—————————————-

Power supplies either home made or commercial switching. Home made can be made iwht parts around the shop or local electronics store. Tendds to run hot and  not that efficent. Switching power supplies can be ought dirt cheap, use less electricity and are the most efficient.

Screenshot from 2015-06-27 04:04:18

Another circuit.

GI83o

—————————————-

Experimental code fir the 4 prong ping detector (vs the 3 ping from Paralax)

Screenshot from 2015-06-29 16:01:58

/* HC-SR04 Sensor
   https://www.dealextreme.com/p/hc-sr04-ultrasonic-sensor-distance-measuring-module-133696

   This sketch reads a HC-SR04 ultrasonic rangefinder and returns the
   distance to the closest object in range. To do this, it sends a pulse
   to the sensor to initiate a reading, then listens for a pulse
   to return.  The length of the returning pulse is proportional to
   the distance of the object from the sensor.

   The circuit:
	* VCC connection of the sensor attached to +5V
	* GND connection of the sensor attached to ground
	* TRIG connection of the sensor attached to digital pin 2
	* ECHO connection of the sensor attached to digital pin 4

   Original code for Ping))) example was created by David A. Mellis
   Adapted for HC-SR04 by Tautvidas Sipavicius

   This example code is in the public domain.
 */

const int trigPin = 2;
const int echoPin = 4;

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
}

void loop()
{
  // establish variables for duration of the ping,
  // and the distance result in inches and centimeters:
  long duration, inches, cm;

  // The sensor is triggered by a HIGH pulse of 10 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  // Read the signal from the sensor: a HIGH pulse whose
  // duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);

  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();

  delay(100);
}

long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}

—————————————-

Simple Arduino emf detector. (bug detector?) Lamp[ seems to blink faster and brighter around magnetic fields. (could not get this to work.)

Screenshot from 2015-06-27 16:05:58


int inPin = 5;             // analog 5
int val = 0;                 // where to store info from analog 5
int pin11 = 11;         // output of red led

void setup() {

Serial.begin(9600);

}

void loop() {

val = analogRead(inPin);                    // reads in the values from analog 5 and
//assigns them to val
if(val >= 1){

val = constrain(val, 1, 100);               // mess with these values
val = map(val, 1, 100, 1, 255);        // to change the response distance of the device
analogWrite(pin11, val);                    // *note also messing with the resistor should change
// the sensitivity
}else{                                                     // analogWrite(pin11, val); just tuns on the led with
// the intensity of the variable val
analogWrite(pin11, 0);                     // the else statement is just telling the microcontroller
// to turn off the light if there is no EMF detected
}

Serial.println(val);                                // use output to aid in calibrating

}

—————————————-

When it comes to home automation, you could use any number of systems such as a off the shelf turnkey solution such as Insteon.Check with your hardware store for more details. You could build it yourself. Unless you are experienced at it, I would let a professional do it, if for no other reason of safety to yourself and others.  If you do do it yourself, you will have to write the software to make it all happen. Though most of it may not be that hard, it can be daunting to the inexperienced. Again get a professional and a mentor. Also any drawings in this article are oversimplified and not to be used in actual systems.  What to do first? You want to make a plan of what you want to do including any budget considerations. (What is it going to cost?)

Home Automation – Requirements ChecklistFunctional Areas:
Controls
Standalone time-based controllers
Remote infrared or wireless (RF) controllers
Local PC only
Local PC w/Internet access enabled
Optional telephone interface for status and control
    Security & Monitoring
Alarm System Integration
Standalone system with outputs
Standalone system with auxiliary inputs/outputs
Custom Alarm System
Motion detectors (people or vehicles)
Security cameras (archive motion triggered video clips)
Zone intrusion detectors (infrared)
Local siren alarm
Alerts (pager or email or dial-out)
Door/Window/Gate open sensor
Barking dog deterrent
Flood lightsActivity Monitoring
Cameras to monitor children or pets
Pet feeders, pet doors, automatic cleaners, pet containment
Electronic door latches
Activity logs
Disaster Recovery
Sensors: water level, extreme temperatures, wind, smoke, rain
Alerts (pager or email or emergency dial-out)Scene Lighting
Everyday after dark lighting scheme
Night time pathway lighting
Event lighting scenes (parties, dining, mood settings)
Dusk/Dawn sensor or calculation from latitude & longitude
Motion triggered lights (i.e. front porch, backyard, interior rooms)
Vacation schedule after dark lighting scheme with auto-variance
    Home Entertainment (A/V) Controls
Room lighting: control drapes, blinds, dimmers
Device power up sequence and configuration
Play selection (CD, DVD, VHS, Cable, Satellite, Media PC)
Channel/volume control
DVD/VCR/DVR control (play, pause, stop rewind, fast forward, eject)
    General control
        Single control –simplified (macro commands)
Remote programming control from the Internet (e.g. TIVO or other DVR)
Home HVAC Controls
Heating and cooling based on single/multiple internal thermostats
Set Heating/Cooling temperature targets via program
Control HVAC mode (Auto, Heating, Cooling, Off)
Ceiling fan controls
Send status on demand or periodic reports
Monitor pool/spa water temperature
Control window shades to lower room temperatureSecurity
        Surveillance Cameras
Stationary cameras with video cable plugs into TV or computer webcam
Pan/Tilt/Zoom (PTZ) cameras (hard-wired or wireless)
Continuous recording of video capture on motion detection
Remote viewing from the Internet (live stream or capture files)
    Miscellaneous
Sprinkler controls (rain detection shut off)
Integrate custom systems (requires computer interface)
Appliance controls (electrical water heater, other)
Integrated Pool/Spa controls
It is apparent, you will need to do some research, not only potential products but, doing some price research. We will go into the above in more detail at a later time.

Now you do not have to implement everything, Maybe even one item is all you need. Now that we have that out of the way, Lets go back to the discussion.  Last time we said that home automation is basically being able to turn something on or off remotely. Let us refine that a little bit. We actually need something to be controlled, a device to do the controlling, and an interface to oversee the controlling.

Something to be controlled can be digital such as on or off like a light switch. That is pretty easy. In some cases though, we need to be able to adjust a device to a certain level and that is analog sort of like measuring with a ruler, light dimmer switch or even with a thermometer.

We need a way to control devices based on a pre-setup instructions which may or many not be dependent on the time of day or feedback from sensor devices,  We can send a signal to turn on an electronic switch as if you just simply turned on light switch or we could use an electronic valve like on a water faucet to adjust those things that are analog.  For example you may want to dim or brighten a lamp. We use a stepper motor that can turn in increments in two directions to adjust a light dimmer switch. This would be as if you were turning the knob on the dimmer. Of course you will want a light sensor to get feedback on how the lamp is doing.

 

If you build it yourself, you can use everything from a microcontroller such as the Arduino to a full fledged computer. The system will need to be able to output the current status and let you change it if need be. For a computer you will need to have some kind of web server installed. The Arduino has a simple interface to be able to ouput to the web if the ethernet shield is attached.

 

So now you have remote control via a simple web page. Next time we will spend some time in the big long list at the start of the article.

—————————————-

Have not tested this, so try at your own risk.

 

 

From Hackaday (http://hackaday.io/project/6258) Single chip  usb temperature sensor.
Description
I  (the Hackaday author) created this project because I wanted to learn about PIC microcontrollers and the USB protocol. I also wanted to see how simple I could make a USB device. I’ve gotten it down to two components: a PIC16F1455 microcontroller and the USB connector. The microcontroller acts as a USB serial device and will send the temperature as an ASCII string once per second.
Details

The PIC16F1455 is a relatively new microcontroller that can do USB without an external crystal. It also has internal pull-up resistors for the USB data lines. These things mean no extra hardware is necessary for USB communication.
I needed something useful to send over USB and I noticed that the PIC16F1455 has a Temperature Indicator Module. This peripheral will let you read the operating temperature of the silicon die over the ADC. It’s not terribly accurate, but the silicon die temperature will be about equal to the outside temperature.

I carefully soldered a male USB Type A connector to the PIC16F1455’s Vdd, Vss, D+, and D- pins. Then, using the M-Stack USB Stack from Signal 11, I wrote a program to enumerate the PIC16F1455 as a USB CDC serial device and send the temperature in ADC counts as an ASCII string at 1 Hz.
From the computer side, it’s easy to connect to the USB temperature data logger like any other serial device, parse the incoming strings, and save the data to a file with a timestamp.
The last step is to map the ADC counts to a temperature scale. Microchip has an application note AN1333 with some equations. However, for a constant Vdd, the scale is pretty linear so it’s easiest to record the ADC count at two known temperatures and interpolate between them.

Looks pretty straight forward.

Some code links:

 https://github.com/mogenson/USBTempLogger

 https://github.com/signal11/m-stack
—————————————-

Try this at your own risk.

From the kodi wiki:

Follow this simple procedure:

  1. Open the receiver’s plastic case using a small screw driver. Carefully pry around the case.
  2. Solder the wire to the receiver using the picture below
  • Note: This might damage the casing of the dongle.

1 Color Coded Pinout

Xbox-dvd-pinout thumb.jpg

  • If you’re using a standard USB cable you should just be able to match the colors and solder away, but to be sure check your cable with a continuity tester according to the USB spec provided here.
  1. Red = Positive Power (+5V DC)
  2. White = Data –
  3. Green = Data +
  4. Yellow = Unused
  5. Black = Ground (0V DC)

Normal usb connections:

Pin Name Cable color Description
1 VCC Red +5 VDC
2 D- White Data –
3 D+ Green Data +
4 GND Black Ground

 

2 Lirc Config

/etc/lirc/hardware.conf:

#Chosen Remote Control
REMOTE="None"
REMOTE_MODULES="lirc_atiusb lirc_dev"
REMOTE_DRIVER=""
REMOTE_DEVICE="/dev/lirc0"
REMOTE_SOCKET=""
REMOTE_LIRCD_CONF=""
REMOTE_LIRCD_ARGS="-r"

#Chosen IR Transmitter
TRANSMITTER="None"
TRANSMITTER_MODULES=""
TRANSMITTER_DRIVER=""
TRANSMITTER_DEVICE=""
TRANSMITTER_SOCKET=""
TRANSMITTER_LIRCD_CONF=""
TRANSMITTER_LIRCD_ARGS=""

#Enable lircd
START_LIRCD="true"

#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD="false"

#Try to load appropriate kernel modules
LOAD_MODULES="true"

# Default configuration files for your hardware if any
LIRCMD_CONF="lircd.conf"

#Forcing noninteractive reconfiguration
#If lirc is to be reconfigured by an external application
#that doesn't have a debconf frontend available, the noninteractive
#frontend can be invoked and set to parse REMOTE and TRANSMITTER
#It will then populate all other variables without any user input
#If you would like to configure lirc via standard methods, be sure
#to leave this set to "false"
FORCE_NONINTERACTIVE_RECONFIGURATION="true"
START_LIRCMD=""

/etc/lirc/lircd.conf:


# brand: Microsoft Xbox DVD Receiever (also works with generic)
# remote control: Xbox remote or any remote using RCA DVD player codes

begin remote

name XboxDVDDongle
bits 8
eps 30
aeps 100

one 0 0
zero 0 0
gap 163983
toggle_bit_mask 0x0

begin codes
LEFT 0xA9
UP 0xA6
RIGHT 0xA8
DOWN 0xA7
SELECT 0x0B
1 0xCE
2 0xCD
3 0xCC
4 0xCB
5 0xCA
6 0xC9
7 0xC8
8 0xC7
9 0xC6
0 0xCF
MENU 0xF7
DISPLAY 0xD5
REVERSE 0xE2
FORWARD 0xE3
PLAY 0xEA
PAUSE 0xE6
STOP 0xE0
SKIP- 0xDD
SKIP+ 0xDF
TITLE 0xE5
INFO 0xC3
BACK 0xD8
end codes
end remote

If using the Xbox DVD IR dongle, add this line to the bottom of /etc/modprobe.d/blacklist.conf:

blacklist xpad


3 XERC 

 The Sickmods XERC 2 XE works really well with an HTPC and the Xbox DVD dongle. It handles power-off and power-on via your remote. Here are some installation instructions for that.

—————————————-

This may not work with all calculators. Here is an interesting way to count footsteps and estimate how far you have walked.You need a cheap calculator, some foam or sponge, glue, foil, cellophane tape, and 2 long wires.

Then you will want to make a switch. To do tha, drilll or punch a hole in the sponge for the to the bottom.  Glue the foil to the top and bottom of the sponge.  The two foil pieces should not be touching. Connect the wires separately to each foiled surface.

Open up the calculator and connect each of the other wire ends to the top and bottom contacts of the “equals” aka = button. Put a piece of cellophane tape between the contract so that they do not connect. Close the calculator and make sure everything works normally. you would have to press the switch together for the = sign to work.  Attach the switch to the bottom of the shoe.

Now enter “1 + 1” into the calculator. Start waking and you will see the count begin to rise as you walk. When you are finished walking multiply the steps to the length of your stride and you will have your distanced walked.

—————————————-

Could see servos being used with this.

servohand

—————————————-

Zuupa di trippa. A stomach full of goodness.

SUNP0003

Good day.

Advertisements