The Arduino UNO is the best board to get started with electronics and coding. If this is your first experience tinkering with the platform, the UNO is the most robust board you can start playing with. The UNO is the most used and documented board of the whole Arduino family.

Arduino Uno is a microcontroller board based on the ATmega328P.

It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header and a reset button.

Arduino General Info

Arduino has many low cost microprocessors.( Uno, Mega, Due. . . )

The Arduino Home Site can be found at:

https://www.arduino.cc/

Arduino is a nice simple solution for many C programming ( C++ if you want ) automation projects, so we will begin with this.

There are many different Arduino boards depending on your desires.

Arduino is a microcontroller with limited memory ( Uno 32k ,Mega 256K, Due 512K).

The I/O is limited, but sufficient if you think of it as a dedicated sub process.

The Analog inputs have a 10 bit (1024) DAQ for input and the PWM output can be filtered for a near analog constant value.

Digital inputs are made for ( 0-5 VDC for Uno & Mega 0-3.3VDC Due) and Digital Outputs can all be ON/OFF limited 40mA current with a PWM output option for several designated outputs.

A great starting point for anyone learning Arduino:

Topic: Useful links - check here for reference posts / tutorials

 

LCD 1602 Keyboard Shield

Picture

This is a simple example of a LCD 16 character 2 line (1602) shield that mounts directly on an Uno or Mega.

This also has an addition benefit of 5 built in buttons with built in series resistors that all use the A0 input.

The buttons use a series of resistors that act as voltage dividers giving each button a unique voltage.

Since resistors do vary, you will need to run the program (Keys_1602shield) to set the voltage ranges.

In serial monitor, you will see the key and the bit integer value.

Write down these values.

In the program, set the break values between these measurements.

NOTE: this LCD shield wiring differs from some LCDs with the code:

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

Then run the LCD_KS_Menu program for a simple menu example.

Use the UP/Down to scroll the menu items.

Use the RIGHT button to set the Digital ouput.

Use the LEFT button to return to the menu and turn the output off.

 

MAX6675 K-Thermocouple

Picture
MAX6675 with thermocouple

Measuring temperatures is one of the basics of most process controls.Thermocouples have been used  for a long time.Thermocouples consist of two dissimilar metal wires joined at a hot junction; as temperature changes, a millivolt signal is generated. The most common alloy combinations are known as type J and type K thermocouples.

Type K Temperature Range: Thermocouple grade wire, –454 to 2,300F (–270 to 1260C)

Advantages of thermocouple sensors include: low cost, small size, wider temperature ranges and faster response than RTDs.

The disadvantages of using temperature thermocouples include: they are less linear and accurate than RTDs, a matching extension wire is needed, and thermocouples are sensitive to electrical noise.

To read the millivolt signal and compensate for the non-linearity, we need to use the MAX6675.

The MAX6675 performs cold-junction compensation and digitizes the signal from a type-K thermocouple.The data is output in a 12-bit resolution, SPI-compatible, read-only format.

Arduino library for interfacing with MAX6675 thermocouple amplifier

NOTE:

MAX6675 temperature range 0 to 1023 Celcius

MAX31855 temperature range -200 to 1350 Celcius

Order MAX31855

 

Arduino 20x4 LCD Module IIC I2C Interface

Picture

Here is a quick simple example for hooking up an LCD to an Arduino.

There are lots of LCD options , but $21/2 with I2C attached was too good to pass up !

This specific example uses:

Arduino Uno R3 $16

SunFounder 2004 20x4 LCD Module IIC I2C Interface Adapter Blue Backlight for Raspberry Arduino UNO R3 MEGA2560 $21 per 2

https://www.amazon.com/gp/product/B07MTFDHXZ/ref=ppx_yo_dt_b_asin_title_o00_s01?ie=UTF8&psc=1

(NOTE: I2C connector module is attached and include with this LCD ! )

The blue potentiometer on the I2C LCD1602 (see the figure below) is used to adjust the backlight  for better display.

Also MEGA compatible with much more memory 256K vs Uno 32K

Video instruction

Electrical Connections: ( 4 wires same for most I2C Adapters )

LCD                      UNO

GND                      Pin GND

VCC                      Pin 5V

SDA                      Pin A4

SCL                      Pin A5

Programming

First you need to download the Sunfounder LCD zip at:

http://www.arduinolibraries.info/libraries/liquid-crystal-i2-c

Install the zip file into Arduino IDE:

Sketch > Include Library > Add .ZIP Library

Check “includes library” menu after installing.

I2C LCD2004

Arduino Ethernet Shield NTP time

Picture
ethernet shield

One of the standard niceties of Data Acquisition systems with PCs is the ability to use  the PC timestamp.

Arduinos do not have a built in RTC timer or easy access for an internet time clock update.

One solution for this is an ethernet shield.

If you are using an Arduino for data logging, you can access the NTP time via an ethernet shield.

Here is a simple example on getting the NTP time.

An added benefit on some shields is an additional SD card for storage.

This works fine alone on the Uno, but comes close to maxing out the 32K of memory.

This shield is also compatible with the Arduino Mega2560 with 256K of memory.

 

Python Firmata USB-Serial

Picture
firmata wiring

Using built in tools is one of the quickest ways to leverage new projects.

Use Python on a PC via the standard USB cable for serial communications to your Arduino.

ARDUINO:

On Arduino you will want to load the standard firmata example program.

No changes needed !

File > Examples > Firmata > Standard Firmata

Analog potentiometer connections standard 5 VDC in, Gnd out, with Analog pin connected in center.

PC:

This tutorial is based on Python 3.7.

Demonstrates Digital input, Digital output, & Analog input.

No Analog output DAC on the Arduino Uno.

Install pyFirmata and time libraries in Python3.

For windows open the command prompt.

For Linux open the terminal.

Type:

pip install pyfirmata

pip install time

Use CTRL-C to stop program.

 

 

Rotary Encoder

Picture
HS Quad Encoder

There are many different types of encoders.

cheap quad
cheap quad
Speed Sensor
Speed Sensor

 

 

 

 

 

 

By definition:

An encoder is a device, circuit, transducer, software program, algorithm or person that converts information from one format or code to another, for the purpose of standardization, speed or compression.

All closed loop systems require an output and a feedback.

Here were are going to show how to use rotary encoders.

Most rotary encoders can be defined as a Speed or Quadrature Encoders.

A speed sensor simply detects a block/no block single to count. NO position change is verified.

A quadrature encoder uses 2 sensors out of phase by 90 degrees to both detect a position change with a verifiable direction.

Both will work with the same program.

For the speed just connect one signal to pin3 ( UNO ).

For the quadrature connect the A/B to pins 2 & 3.

Reversing the connections will just change the direction as count up or down.

An additional GND reset button to Pin 0 is added.

Both the speed sensor and HS Rotary encoder work fine directly connected to the Arduino.

LPD3806-600BM-G5-24C

Operating voltage: DC5-24V

Wiring:

green=A phase, pin 2

white=B phase , pin 3

red=Vcc positive supply,

black=GND

 

 

The cheap rotary quad encoder has internal resistors, but needs additional de-bounce circuitry :

DT - Encoder Pin B #3

CLK - Encoder Pin A #2

SW – PB Switch NOT USED

De-bounce circuit
De-bounce circuit