Category Archives: Electronics

Setting up Raspberry PI wlan

Setting up raspberry pi from the command line

Open a terminal on the pi or use ssh to connect to your pi (showing ssh here use hour own pi ip and de default user pi)

$ ssh 192.168.1.19 -l pi

and your password (default one is ‘raspberry’) and your good to go

/etc/network/interfaces looks just like this (open with the nano editor):
sudo nano /etc/network/interfaces


auto wlan0
iface wlan0 inet dhcp
wpa-ssid “???TPLINK!!!”
wpa-psk “verysecret-wpa-psk”


and that worked (there are more entries in this file just add these below)

The Wifi dongle I got from thepihut

Original source post can be founf here

Subnote (if using sitecom CN-061 USB Hub):


Sitecom USB Hub CN-061 7 Port USB 2.0 Hub powered with AC Adapter. There is a voltage problem on the left half of the hub (4 ports) that do not deliver enough current to feed a wifi dongle (tested with an RTL8191S); you should not use these ports for anything important (keyboard keys will stick, self-powered USB hard disk will reset continuously). The remaining 3 ports on the right half are instead working as expected.


Source here
But the 3 ports that should work did not work with this wifi dongle so i ended up connecting it directly to the pi

3-axis-accelerometer DMARD03

Well i sometime buy stuff from dealextreme (mostly adruino stuff) but there is an problem. I mean it does get schipped to the Netherlands no problems with that, but there no manuals attached ;-).

In this case its a 3 axis accelerometer:
http://dx.com/p/3-axis-accelerometer-sensor-module-for-arduino-red-147319

On the chip is says:
DMT
ARD03A
114306

But its name is:
DMARD03

Its only 7 dollars so a bought it 🙂 but how to hook it up to an arduino ? i had now idea after some googleing (is that a word) i found a blog (in chinese) from Cooper Maa that uses the same chip that was on my board and even better had a nice little library (thanks) and diagram. It was not Arduino 1.0 ready but that was a easy fix. With help from the data sheet i could make it work on my board.

Diagram below (not sure about the 3V3 voltage hookup i think it needs a level shifter like a 74 HC 4050 , but it seems to work, again not invented here 😉):

Program (also included in de lib) (again not my work but from Cooper Maa):

/*
 * DMT_G_Sensor.pde:  DMARD03 
 */

#include                 //  DMARD03 

                                    // DMARD03  gSensor 
DMARD03 gSensor(2, 3);            // dataPin = 2, clockPin = 3

void setup()
{  
  Serial.begin(9600);                //  Serial port,  9600 bps
}

void loop()
{
  DMARD03_results results;          //  DMARD03_results  result 
  
  gSensor.readXYZ(results);         // (Accerleration) 
  
  // X, Y,Z  (Accerleration)  Serial Port
  Serial.print("X = "); Serial.print(results.X); Serial.print(", ");
  Serial.print("Y = "); Serial.print(results.Y); Serial.print(", ");
  Serial.print("Z = "); Serial.println(results.Z);  

  delay(200);  
}

Sources for the Arduino lib:
DMARD03 Lib
Datasheet:
DMARD03 Datasheet V2.3
Original blog post that helpt me a lot:
http://coopermaa2nd.blogspot.nl/2011/04/dmard03-accelerometer.html

LCD PC1602-H Connected to Arduino

I have a lcd display that is a bit different then the others i have. And a keep forgetting how to hook it up to a arduino.

lcd pc1602h

De pin lay out is as follows (seen from the top):
[16][15]
[14][13]
[12][11]
[10][09]
[08][07]
[06][05]
[04][03]
[02][01]

Pin assignment:

Pin assigment

Arduino code:

#include "LiquidCrystal.h"
// POWERTIP LCD PC1602 - H
// LiquidCrystal display with:
// rs lcd  pin 4 on arduino pin 12
// rw lcd pin 5 on arduino pin 11
// enable lcd  pin 6 arduino on pin 10
// d4,d5,d6,d7 lcd pins 11, 12, 13, 14 on arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int wait=1000;
int val=0;
void setup()
{
    // Print a message to the LCD.

    lcd.begin(16, 2);
    lcd.setCursor(0,0);
    lcd.print("Hello");
    lcd.setCursor(0,1);
    lcd.print("Arduino");
}

void loop()
{
    // set the cursor to column 8, line 1
    // (note: line 1 is the second row, since counting begins with 0):
    lcd.setCursor(9, 1);
    // print the number of seconds since reset:
    lcd.print(millis()/100);
}

// rs on pin 12
// rw on pin 11
// enable on pin 10

Connections:

LCD <-> ARDUINO
[16][15] [—][—]
[14][13] [D02][D03]
[12][11] [D04][D05]
[10][09] [—][—]
[08][07] [—][—]
[06][05] [D10][D11]
[04][03] [D12][Contrats]
[02][01] [-5V][GND]

Well as you can see not soo different at all but te pin layout on a Chinese LCD board YM1604AP had a more “normal” layout :
[01][02][03][04][05][06][07][08][09][10][11][12][13][14][15][16] but the connections are the same
so:
[01] GND
[02] +5V
[03] contrast
[04] RS
[05] RW
[06] Enabled
[07..14] DB00..DB07
[15] A + LED BL
[16] K – LED BL

Image of it all 🙂

Arduino connected to LCD PC1602-H