Setting up eth0 and wlan0 on a Raspberry PI RevB (no drivers)

Recently I setup a raspberry pi to talk to the internet via ethernet here. I asked myself how do you configure Ethernet and wireless on the radpberry pi?

Today I added a wireless card and set it up so it can talk to the network too.

Step 1: Wireless Dongle.

I purchased 1x EDUP Model EP-N8537 Wireless LAN 150Mbps USB Adapter from eBay for $7.95 ( , item).

wlan0b

Step 2: Configuration.

I plugged my new Wireless card into Windows and ran the following command to get the MAC Address for the new card. Write the Mac Address down.

    ipconfig /all

I then connected to my ADSL router and went to the Static IP section under LAN/DHCP.

I added a static IP reservation for this mac address to my router and gave it an IP that I was happy with.

I then booted the Raspberry Pi (don’t connect the Wireless card yet). I typed the following command to open the network interfaces file.

    sudo nano /etc/network/interfaces

I deleted the contend of my interfaces file and typed this in.


    auto lo
    face io inet loopback

    iface eth0 inet static
    address 192.168.1.200
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.1.204
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
    wpa-ssid yourwirelessnetworknamehere
    wpa-psk yourwirelesspasswordhere

If you are unsure of what to type above go and check out the hundreds of awesome and free security/networking podcasts here https://www.grc.com/securitynow.htm.

Step 3:Reboot.

I ran a safe shutdown, inserted the WLAN adapter and rebooted.

Now I can use the ethernet or WIFI.

wlan0a

No drivers or non fee DEB packages were installed to get this NIC working.

Bonus tip: I am using a Ethernet over Power adapter connected to a wireless extender to allow my arduino/raspberry pi to connect to my router.

Arduino/Pi -> Gigabit Switch -> EoP A -> 240v (50m) -> EoP B -> 100MB Switch -> WiFi (30m) Extender A -> WiFI -> WiFi Extender B -> Router -> Internet :)

Tips on soldering circuits on strip vero boards (part 1)

Tips on soldering circuits on strip vero boards (part 1).

1. Have a final circuit design (prototype on a large breadboard first with all sensors etc).
2. Print the final circuit design (both sides).
3. Have a cut list.
4. Test cutting strips and cross strip joining with solder or wire.
5. Solder least expensive parts first.
6. Solder shortest parts second.
7. Consider a complete arduino as a base ($40) compared to the time building a $30 system from scratch. Pros and cons of custom over standard shields.

More tips to come.

My first standalone ATmega328P/arduino breadboard

Having played with a Freetronics TwentyTen for a while I now want to build my own ATmega328P MCU powered devices running from batteries as cost affective as possible.

I followed this guide and ordered the parts for 2x solo units. I ordered the ATmega328P MCU etc from http://www.wiltronics.com.au.

willatmega328p

Maybe I should have ordered this one from freetronics. The label on the freetronics chip would be handy.

Freetronics_ATmega328P_with_bootloader_and_label_002_medium

This was the result of replicating the standalone arduino system on a breadboard.

The breadboard wire kit did not have a lot of red and black wires so please forgive the crazy colours. I did not have a momentary switch so I got creative with two vertical wires.

standalone_arduino_01a

One stumbling block was how do I program my arduino (as I did not have a stand alone programmer). I tried removing the existing chip from the Freetronics TwentyTen but it would not budge. I tried with more force but the chip would not budge. On closer inspection I could not see if the chip was soldered into the DIP socket (Googling did not say if it was or not). I considered de soldering the square style dip socket and replace it with a round style dip socket that uses less force. But luckily I decided to gently lever up the chip on both sides with a flat screwdriver and bingo, the chip popped out.

standalone_arduino_01b

Programming Considerations.

The chip that came in the Freetronics TwentyTen needs to be programmed as:

      • Board: Arduino Nano w/ATmega328
      • Programmer: AVR ISP

 

The ATmega328P MCU chip that came from Willtronics needs to be programmed as:

    • Board: Arduino Uno
    • Programmer: AVR ISP

 

The Result

standalone_arduino_01d

Where to Next

Moving from a large breadboard down to a permanent circuit soldered to a board and actually driving sensors etc.

standalone_arduino_01e

Virtual COM Port (drivers) not installing via Arduino.cc IDE on Windows 8.1

I recently performed a clean install to Windows 8.1 and found that there was no COM port driver loaded for my ATmega328P Microcontroller (TwentyTen Arduino compatible) from Freetronics when installing the Ardrino.cc 1.0.5 IDE.

    tt_top_01_480w_large

I read the getting started guide.pdf at freetronics with no luck. Opening the device manager and automatically searching for driver does not work on Windows 8.1.

A quick google revealed this virtual com port driver that is WHQL certified for Windows 8.1

Win81COMDriver

Freetronics Temperature and Humidity Sensor (DHT22)

The Sensor

Today I plugged in my new DHT22 temperature and Humidity sensor (buy here).

dht22-sensor

    Features:

  • -4°C to +125°C temperature range with +/-0.5°C accuracy
  • 0-100% relative humidity with 2-5% accuracy
  • 0.5Hz sample rate (one sample every 2 seconds)
  • 3 to 5V operation
  • Power consumption just 4.3mA during reads, even less when idle
  • Blue power LED
  • Dimensions: 31(W) x 23(H) x 4(D)mm

The Wiring

  • VIN: Connect to 5V on your microcontroller.
  • DATA: Connect to a digital I/O line on your microcontroller (e.g Pin 13).
  • GND: Connect to GND (0V) on your microcontroller.

The Code

    >#include
    #include

    #define DHTPIN 13
    #define DHTTYPE DHT22

    DHT dht(DHTPIN, DHTTYPE);

    void setup()
    {
    Serial.begin(115200);
    dht.begin();
    }

    void loop()
    {
    float h = dht.readHumidity();
    float t = dht.readTemperature();

    if (isnan(t) || isnan(h))
    {
    Serial.println("Error reading DHT!");
    }
    else
    {
    Serial.print("Humidity: ");
    Serial.println(h);
    Serial.print("Temp: ");
    Serial.println(t);
    }
    delay(2000);
    }

The Results

Values before and after breathing into the sensor.

    dht22_values

Troubleshooting

I was saving the DHT driver files (DHT.h) to “C:\Program Files (x86)\Arduino\libraries\DHT” and not “%UserProfile%\My Documents\Arduino\libraries”. This is common knowledge but no one says this here, here or here.

Home Security Ardrino Project

A few years back at AgQuip retailers were flogging $400+ sensors for farm driveways to detect and notify property owners of activity across certain points. Thse days $400 can buy you a lot more automation.

Watching NYCCNC Youtube channel video that involved lasers to count things gave me an idea. Why not use the same near invisible low powered lasers to create an invisible beam across many areas like a driveway or back door. An Ardrino can easily poll these lasers well over 1 million times a second. Using two laser beams a few centimetres apart would allow you to predict the number, direction and potentially the size of the object(s) passing through. If different height lasers (with a magnetic sensor) were setup you could predict animals (kangaroos, echidnas) kids, adults, cars or trucks.

Once an object has been triggered why not activate a $30 raspberry pi camera or another camera and start capturing and uploading offsite. Notification triggers could be sent (SMS, Tweets, Emails etc via a central Raspberry Pi computer).

HomeSecurityArdrino

Parts would be inexpensive and trivial to setup.

Custom Arduino Greenhouse Monitoring System

After I complete my Weather Station Project Idea (Ardrino) I will move onto this project.

Using temperature/humidity/soil moisture sensors and a tap solenoid (recycled) I could automate my greenhouse watering. The system will be internet aware with a control panel to override the sensors.

CustomArduinoGreenhouseMonitoringSystem

The 555 Timer will trigger update events and the 4 bit timer is really there to help switch open circuits to reuse the limited analogue pins on the Ardrino, EEPROM will save data if the internet is offline. I plan on open sourcing all code and designs.

Weather Station Project Idea (Ardrino)

So here is the idea, I have heap of sensors from ebay that I have working individually (temp, Humidity, pressure etc) so why not build a weather station.

The most expensive/time consuming part would be building the mechanical stuff to detect the wind/rain (pivot bucket with magnetic sensor) and a solar panel/wifi module. Technically this should not be too hard. A 3D Printer would be handy.

ArdrinoWeatherStationProject

The 555 Timer will trigger update events and the 4 bit timer is really there to help switch open circuits to reuse the limited analogue pins on the Ardrino, EEPROM will save data if the internet is offline. I plan on open sourcing all code and designs.

Hacking an Aqua Systems Two Dial Electronic Tap timer with an arduino/wifi

Bunnings sell cheap Aqua Systems Two Dial Electronic Tap timers that allow you to set a repeating timed/duration watering system that you connect to a standard hose fitting. The problem is this does not factor in watering restriction guidelines, rain events or variations in the weather.

One of my goals is to hack an Aqua Systems Two Dial Electronic tap timer and replace its circuitry with an Arduino micro controlled that is connected to the web/online schedule.

20131212-075548.jpg

Opening the timer reveals a simple 3v IC, 3V motor, torque increasing plastic gears, flexing circuit breaker connected to a gear and a rotating ball joint to allow/ block water flow.

20131212-075600.jpg

20131212-075609.jpg

The plan is to remove the built in circuits and replace it with an atmega328p, 484Mhz wireless transmitter, upgraded 6v power and reuse the motor, gears and housing.

20131212-075447.jpg

Each hacked unit will communicate with a single house raspberry pi that handles the schedules etc