Tuesday, March 11, 2014

Arduino 4x20 LCD and 2 inputs comparator

Staring a new build. So as to that I had an idea, that it can be helpful for everyone starting with code writing to try and manipulate this snippet. It's a simple code to operate a LCD and 2 inputs on A0 and A1. It compares the two with if and else. After the comparator it makes a readable output on the LCD. From here it's very simple to put the comparison into outputs of your own choosing.




//4x20 LCD, 2 sensors in A0 and A1 compare them and output to the LCD
// include the library code:
#include <LiquidCrystal.h>

// initialize the library liquidcrystal.h with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int sensorPin1 = A0; // defines input pin
int sensorValue1 = 0; // make a varianle sensorValue
int sensorPin2 = A1;
int sensorValue2 = 0;

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(20, 4);

}

void loop() {

  sensorValue1 = analogRead(sensorPin1); // get the value of sensor 1
  sensorValue2 = analogRead(sensorPin2); // get valur for sensor 2

    lcd.setCursor(0, 0); // Set cursor to top left
  lcd.print(sensorValue1);

  lcd.setCursor(0, 1);
  lcd.print(sensorValue2);

  if (sensorValue1 < sensorValue2){
    lcd.setCursor(0, 2);
    lcd.print("1 is higher than 2");
  }
  else{
    lcd.setCursor(0, 3);
    lcd.print("2 is higher than 1");
  }

  delay(200);
  lcd.clear();


}

Sunday, February 2, 2014

Max7219 and a LED matrix with Arduino, blinking LED-s the hard way

DIY led matrix
DIY 7805 PSU
 First trial to make the 7219 work with Arduino. I had ordered the MAX7219-s a good few months ago, but still hadn't made anything with them. So this is mi stab at making them work. In mi junk bin i had a bunch of perf board and white led-s so just a matter of soldering together I thought. Well soldering is the easy part but to mi surprise it took a good hour or so to solder the 7805 coupled with 7219 and the led matrix together.

So mi first attempt. To replicate or try it for yourself you need.

  • Soldering iron
  • 30 LED-s
  • MAX7219 IC
  • 7805 Voltage regulator
  • 10 uF and 100 uF capacitors
  • jumper wires

Max7219 connected with DIY 5x6 Led matrix



Wednesday, January 22, 2014

Wireless 433mHz with Arduino, hitting the radiowaves

433mHz sender unit(left) and receiver unit (right)
I picked a pair of these up for 0.99$ each, so who can resist the tempation.

ACS712 30A interface with Arduino, measuring power usage

ACS712 30A sensor
The ACS712 is a hall-effect sensor, so when in using it be careful not to have any magnetic interference hitting the thing.There many variations of the IC this here is the 30A version. The current capabilities it can handle id conveniently located on the chip itself.

LCD and Arduino, getting readable output

16x2 on the top and 20x4 LCD on the bottom
The 16x2 LCD is salvaged from a 48V PSU that had lost it's magic smoke in a spectacular way. So guud guy that i was i hauled it home and dismantled it before it met it's end in a bin.

MPU-6050 and Arduino, sensing board movement

MPU-6050 sensor board
The MPU-6050 combines within itself both accelerometers and gyroscopes in all 3 axis. It outputs all of the data on a I2C output.

Monday, January 20, 2014

ULN2003 and Arduino, steppermotor control

ULN2003 and stepper motor 5V
This is the cheapest combination of stepper motor and controller i could get mi hands on, through ebay(2.92$ with shipping).

First impressions for this set is that you get what you pay for. The ULN2003AN is a Texas Instruments DIP chip. Circuitboard measures 32mm in width and 35mm in length. Chip is seated on a socket so if there are any complications, as in the magic white smoke leaking out, you can replace the chip. All of the board is a full through hole design so again if anything misbehaves just replace it. Soldering job is adequate for this kind of cheap-o standard. One solderbridge but that's the only thing that's amiss.

The Stepper motor supplied has the markings a 28BYJ-48, so it has 4 phases 8 beats. With internal gearing in 1:64. It's rated at 5V DC. Motor-s diameter is 28mm. And is supplied with 20cm wires.On the sides it has two mounting holes for screws, rivets or anything else you can think of for mounting.

Code for testing  

ENC28J60 and Arduino, ethernet for your microcontroller

ENC28J60
DATASHEET for the main chip on board.

What is Arduino

Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board (as said by the developers of Arduino).


Cheapest arduino choices 

In all things combined it's the next best thing since the computers were invented. Anything you can imagine you can develop with it, and if you want to go to masses you can always strip it and use the Atmega microcontroller. 

Okay there are a few defects, mainly no integrated graphics department. But there are workarounds for that, although not as powerful that there should be but still it's a possibility.

In mi opinion why it's the next best thing is because it's popularity has skyrocketed. Because of that there are endless add-ons for it. That's why I said you can do everything with it, and so much has already been done by the community. Also the community who can argue with that. If you could ever get in some kind of trouble, there is always someone who can help you.