Showing posts with label DIY. Show all posts
Showing posts with label DIY. Show all posts

Wednesday, 22 March 2017

LCD Displays - Arduino

 Here is a basic LCD project.
A LCD is a  Liquid Crystal Display.
It uses a 16x2 LCD display. 
The exercise uses an Arduino.
Some of the older LCDs that Ive tinkered around with have a different pin out, but the basic ideas are the same.
 
 
I'm doing this project as it's good way to learn a bit about this older but proven technology.
LCD displays are often used in DIY projects, so  this info should come in useful one day.
I'll add to this page over time as I fix the odd synth. 

 LCD's are pretty commonly found in older synths. It is sometimes possible to restore older synths with newer OLEDs , but you may wish to stay as close to the original.
 

For many instruments such as the Yamaha SY99 & Korg Wavestation, there are no OLED replacements. They need LCD display replacements.
 
LCD's are different to OLEDS.
LED LCD screens use a backlight to illuminate their pixels, while OLED's pixels actually produce their own light. 
The back light commonly burns out. 
Some of these LCDs had no backlight o

 

LCDs are thicker, heavier and consume more power than OLEDS.
 
 
1.VSS = GND
2. VDD = VCC = 5V
3. Vo = display contrast pin - you will often connect the wiper of a pot to this
4. RS = register select
5. RW = Read/Write
6. E = Enable
7 to 14. D0 to D7 = data pins 
15. A = Anode - for the LED Backlight
16. K = Cathode - for the LED Backlight
 
I've used TinkerCad to test these circuits.
 
 Example 1
This LED screen  displays "Hello World"
Such a simple project.
These are the connections:
The resistor is 220 ohms
The pot is 250K ohms


/*
  LiquidCrystal Library - Hello World

 Demonstrates the use of a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>

/* initialize the library with the numbers of the interface pins
we are creating a LC object
The parameters of this object should be the numbers of the Digital Input pins of the Arduino Board 
respectively to the LCD’s pins as follow: (RS, Enable, D4, D5, D6, D7).
*/
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}
 --------------------------------------------------------
Example 2
Many thanks to
www.HowToMechatronics.com
This uses the same circuit as above.
 I've changed the code a bit, so it works with the old circuit.
 


* Arduino LCD Tutorial
*
* Crated by Dejan Nedelkovski,
* www.HowToMechatronics.com
*
*/
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // Creates an LC object. Parameters: (rs, enable, d4, d5, d6, d7)
void setup() {
 lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display }
}
void loop() {
 lcd.print("Arduino"); // Prints "Arduino" on the LCD
 delay(3000); // 3 seconds delay
 lcd.setCursor(2,1); // Sets the location at which subsequent text written to the LCD will be displayed
 lcd.print("LCD Tutorial");
 delay(3000);
 lcd.clear(); // Clears the display
 lcd.blink(); //Displays the blinking LCD cursor
 delay(4000);
 lcd.setCursor(7,1);
 delay(3000);
 lcd.noBlink(); // Turns off the blinking LCD cursor
 lcd.cursor(); // Displays an underscore (line) at the position to which the next character will be written
 delay(4000);
 lcd.noCursor(); // Hides the LCD cursor
 lcd.clear(); // Clears the LCD screen
}
 
----------------------------------------------------
 
 
Links (Paul McWhorter)
 

Sunday, 19 March 2017

Arduino Dimmable LED - Linear Equations

 Dimmable LED Project
 
This brings up the subject of Linear Equations.
 0 to 1023 - this is the read value (potValue)
0 to 255  - this is the write value range. (LEDvalue)
 
we need to read one value range and convert to another value range. 
 
Led Val = y axis
Pot Val = x axis

m= (y2 -y1)/(x2-x1)
m = (LED Val2 - LED val 1) / (pot val2 - potVal 1)
m = (255-0) / (1023-0) = 255/1023
or
y-y1 =m(x-x1)
or
LED Val - LED val 1 =m(pot val - potVal 1)
LED Val - 0 =m(pot val - 0)
LED Val =m(pot val)
 LED Val =m * pot val
 
Thus 
LED Val = (255/1023)pot val
 

 
 The code:
------------------
// declare your variables
int potPin=A1;// 0 to 255
int gPin=6; // green pin
int potVal; // 0 to 1023 - potentiometer
float LEDVal; // will calculate it depending on potVal
 
void setup()
{
  pinMode(potPin, INPUT);
  pinMode(gPin, OUTPUT);
  Serial.begin(9600); // opens serial monitor
 
}

void loop()
{
  potVal=analogRead(potPin);
  LEDVal=(255./1023.)*potVal;
  analogWrite(gPin,LEDVal);
  Serial.println(LEDVal);
}
--------------------------------------------------------------

Thanks to Paul McWhorter (Tutorial 14)

 ---------------------------------
-------------------------------------

Friday, 17 March 2017

Arduino - analogWrite() Command & PWM

 The analogWrite command writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. 
 
Earlier, we learnt how to do digital writes -- where you can set a pin to output HIGH or LOW
There are13 pins that can do this.
 
After a call to analogWrite(), the pin will generate a steady rectangular wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite()) on the same pin.
 
PWM Pins for the uno - 3,5, 6,9,10,11. (the numbers with the ~)
So rather than only being able to out HIGH & LOW voltages as in the digitalWrite command,
the analogWrite command allows us to do voltages between 0V & 5V

 

Syntax

analogWrite(pin, value)

The resistor is 330 ohm


 The code:

--------------------------------------------------------------------

// Variables
int redPin=9; // chooses the pin
int bright=255; // sets the brightness of LED
                // changing number will change the voltage

void setup()
{
  pinMode(redPin,OUTPUT);
}

void loop()
{
  analogWrite(redPin,bright);
  // use a number between 0 and 255
  // 0 = 0V, 255 = 5V, 125 = 2.5V
  // 1, 2, 4, 16, 32,64, 128, 256
  // 2 to the power of 8
  // 258 = 8 bits resolution
 
 
}

--------------------------------


PWM (Pulse width modulation) doesn't give us a true analog voltage.
It is a technique for getting analog results with digital means.
 
It creates square waves  ie, a signal switched between on and off.
If you repeat this on-off pattern fast enough the result is as if the signal is a steady voltage 

By changing the period of time (duty cycle) the signal is on 5V vs the period its on 0V, you get an average of the voltage, and this is your "fake analog voltage".

 
If you really want an analog voltage, you can place a capacitor ... this will smooth that up/down voltage fluctuation.
1000uF is a good value to use.
 (put the -ve of the capacitor to the -ve (ground) & the +ve to +ve)


 ---------------------------------
-------------------------------------
 

Tuesday, 28 February 2017

Integrated circuits - classification - Families & packages

ICs are mainly classified according to their family & packaging.
Building synths these days means ordering parts from various suppliers.
Olders synths often use parts developed decades ago.
IC packaging has evolved from the simple through hole in the 1970's  to mini SMD & STM today

It's essential to know pin numbers.
Each pin has a special function.
Pin 1 is always located  below the notch, dot or band in a DIP package.

Pins are numbered counter clockwise, starting from pin 1.
Thus, the last pin, is always located above pin 1.

ICs are also classified into families:
The 3most common are:
1. TTL (Transistor - Transistor - Logic)
2. CMOS
3. Linear - mainly amps, oscillators, regulators, etc


Packages
So many ......
The most common are:
1. Dual In-line Package (DIP)
2. Small Outline Package (SOP)
3. Quad Flat Package (QFP)
4. Ball Grid Array (BGA)

1. DIP = Dual inline package.
It's through hole.
It consists of two rows of pins . It connects to a circuit board with either a through-hole or a socket.
The pins are spaced by 0.1" (2.54mm). This is a standard spacing designed for fitting into breadboards and other prototyping boards.
          

The IC is designed to fit perfectly into the big gap in the centre of the breadboard.
There is a  0.3″ (7.62 mm) spacing between the two rows of pins.
This type of package is great for your synth DIY experiments.
You can have up to 64 pins on such a package.


2. SOP = Small Outline Packages
When it comes to Surface mount, you will often use SOP (Small-outline package) types for the ICs.
These usually have a rectangular shape with pins along two edges.
 ICs will also use the SOIC Small-outline integrated circuit package.

With SOIC packages, each pin is spaced by about 0.05" (1.27mm)

 Another common IC SMD package is the TSOP (Thin small-outline package).
TSOPs are common on ICs that power RAM and flash memory.
They are very low-profile (about 1mm) and have tight lead spacing (as low as 0.5mm).

SSOP (shrink small-outline package) is an even smaller version of SOIC packages.

 Notice that one edge has a bevel.
This bevel also lies on the side with the dot marking pin 1.
You can also see the notch .
Sometimes, the ICs are so small, that the dot isn't visible or present.
Thus, look for the bevel when trying to orientate the chip






TSSOP (thin-shrink small-outline package) is yet another variation.
It has a rectangular surface mount plastic package with gull-wing leads.
It is also smaller and thinner than a TSOP with the same lead count. 
The TSSOP comes in body sizes of 3.0mm, 4.4mm and 6.1mm. 
Lead counts range from 8 to 80. 





You may com across these adapters:
I get these from RS components
They are useful for converting various Small Outline packages
 (SOP/SSOP/TSOP/TSSOP/MSOP/QSOP) to dual in line package (DIP) format.



3. QFP = Quad Flat Packages.
Mostly, these are flat and square.
You will see the component with leads along each of the four edges.
QFPs can have pin numbers ranging from 32 pins to 304 pins.
It all depends on the pitch range.
The shape can vary too ... include low-profile and thin. 

These are really common in your microcontrollers
This is a Teensy 3.2
Micro-controllers are getting pretty common in Synth DIY, esp in Eurorack

4. Ball Grid Array (BGA)
You hopefully wont encounter any of these in synth DIY.

One side is covered with balls of solder. These are the connectors.
You will need special instruments ...either a reflow oven or hot air gun to work with these.
Specialised rework stations, vacuum devices to lift the IC, and  thermocouples to monitor the temperature are needed when repairing these.


----------------------------------------------------------
Transistors  and diodes often use this type

The old metal cans. These are named : TO-3/5/8/18/39/46/52/72
These can have many more than just 3 pins.
In the 1960's early chips were housed mainly in either TO-5 or TO-18 packages
These were commonly used to package bipolar transistors.
http://www.ti.com/lit/an/snoa033/snoa033.pdf

The metal can was ok, but as more and more leads were added something more
durable was needed.... thus the DIP package was invented.

Thursday, 16 February 2017

Power Supply - NLC - Build notes

Building a Nonlinearcircuits PSU.
This just supplies +/- 12V for Eurorack modulars.

Andrew's build notes are here:
http://www.sdiy.org/pinky/data/WAMOD3%20%20psu.pdf


The virgin PCBs

 Ok, lets twerk
Keeping Miley happy.

The PCB receives 12VAC from a plugpack/ wallwart
. The 1N4004 diodes split this into positive and negative waveforms.
 
The 4700uF capacitors then smooth out these waves
. The 7812 and 7912 regulators then convert the rectified & smoothed
signals to +12V DC and -12V DC and these are fed to the connectors to be distributed to your lovely modules.
I'm using 250v TDK film caps for the four small 100nf caps
Probably a bit overkill, but it's what i had in stock at the time.


Some pics of the 7812 & L7912 voltage regulators attached to various heatsinks.


 In the NLC build notes, Andrew stresses the importance of isolating the regulators from the heat sinks.

The smaller heatsinks came with grommets and mica insulators, so I think I'll use those.
He also recommended using heatsink paste.

Andrew F recommended I use these - http://www.taydaelectronics.com/capacitors/electrolytic-capacitors/4700uf-50v-105c-radial-electrolytic-capacitor-19x40mm.html

25V caps are okay but better to get 35V or 50V rating. just to keep the action well clear of the edge.

Always bigger is better with heatsinks, smaller ones cant soak off so much heat so will limit the current output of the regs. With a small one you will only get 3-400mA, a big one will get you double that (roughly...very)

The other thing to watch is the proximity of the heatsinks to the caps.
They do appear to be pretty close in the pics.
My sinks don't appear to get hot but they could cause problems if the temp exceeds the cap ratings.
These caps have a rating of 105 degrees celsius.

------------------
This PSU also has space for a 78L05 regulator.
Most of these are rated at 100mA

However, a standard LM7805 can be as high as 1A
A LM7805 might be a good substitution
If you are substituting remember:

1. the pinout is different so the 7805 goes in backwards

2. the 7805 can suck a lot more current than the 78L05 (10x more) and can take as much as the 7812, so keep it in mind and dont try to overwork it.


No need to change caps.

I'm using 1K resistors for the LEDs

-----------------------------------------------------------------------------------
You can find more NLC builds here.
---------------------------------------------------------------------------------------


Wednesday, 1 February 2017

Fairlight IIx - The 8 Inch Floppy Drives

Some pics of the 1980's 8 inch floppy drive.
A computer tech friend of mine said he remembered buying these for around $800 AUD back then.
This was a time when the average price of a new car was $9,000.

Taken from the rear of the computer. Ribbon & power cables removed.
The top of the drive




The underside of the drive.
In excellent condition considering its age.

 That rubber belt looks good for another 30 years.

The DS settings select the drive number.
Things really haven't changed much in this time

This was the secondary fairlight drive - used for holding the Sound Disk.
It's setting was DS2

The primary drive for holding the OS was set as DS1



---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------