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

Soil Hygrometer Moisture Water Sensor for Arduino

The Hardware

Purchase for less than $2 from eBay.

MoistureProbe

The Wiring

  • VCC = 5V
  • GND = GND
  • DO = Digital 2
  • AO Analog 1
  • MoistureProbe2

The Code

    const int VAL_PROBE = 1; // Analog pin 0
    void setup() {
    Serial.begin(9600);
    }
    void loop() {
    int moisture = analogRead(VAL_PROBE);
    Serial.println(moisture);
    delay(100);
    }

The Output

  • Mid Air = 667
  • Soil (in a cup after 3mm Rain) = 539
  • Tongue = 319
  • Soil (in a cup with a few teaspoons of water added (tap water)) = 284
  • Soil (in a cup with a maximum saturation (tap water)) = 162
  • Soil (in a cup with a maximum saturation (tap water with salt added)) = 59