Saturday, 1 April 2017

I2C LCD display - arduino

 

 This is not your usual LCD.
It's a 1602 16X2 LCD Display IIC/I2C/TWI/SPI Serial Interface Module For Arduino
 It has a backlight and is ideal for displaying text characters... 32 ASCII in 2 rows.
There is room for 16 characters in each row.
Each character is made up of a tiny grid of 5x8 pixels.

There is also a 20 character by 4 lines version

The pin resources of many Arduinos are limited.
I'm using a Uno.
Sometimes the project may be not able to use a normal LCD once it's  connected with sensors, etc. Sometimes, you use up to 8 pins.
 
However, with this I2C interface LCD module, you can display data with only 2 wires..... I2C (and of course Vcc & Gnd)

The I2C is a type of serial bus developed by Philips, which uses two bidirectional lines, called SDA (Serial Data Line) and SCL (Serial Clock Line).  
 
 
The supply voltage is 5V 


Many adapters use a 8-bit PCF8574 chip from Texas Instruments which does the i2c data conversions.
Here is the datasheet:
 
This particular adapter is from NXP Semiconductors.
Here is their datasheet.
 

 There are 4 connections
GND
Vcc - 5V
SDA - serial data  (A4 on the Uno)
SCL - serial clock (A5 on the Uno)

The trimpot adjusts the LCD contrast.




Note the jumper on the left of the board. This supplies power to the backlight. 
 
If you wish to control the intensity of the backlight,  remove the jumper and apply a control voltage to the pin that is marked as ‘LED’.
 
 
Before you can use it you need to find the i2c address of the display
Here is a simple piece of code to upload to the IDE

scanner code
********************************************
Thanks to Nick Gammon.
 
  1. // --------------------------------------
  2. // i2c_scanner
  3. //
  4. // Version 1
  5. //    This program (or code that looks like it)
  6. //    can be found in many places.
  7. //    For example on the Arduino.cc forum.
  8. //    The original author is not know.
  9. // Version 2, Juni 2012, Using Arduino 1.0.1
  10. //     Adapted to be as simple as possible by Arduino.cc user Krodal
  11. // Version 3, Feb 26  2013
  12. //    V3 by louarnold
  13. // Version 4, March 3, 2013, Using Arduino 1.0.3
  14. //    by Arduino.cc user Krodal.
  15. //    Changes by louarnold removed.
  16. //    Scanning addresses changed from 0...127 to 1...119,
  17. //    according to the i2c scanner by Nick Gammon
  18. //    https://www.gammon.com.au/forum/?id=10896
  19. // Version 5, March 28, 2013
  20. //    As version 4, but address scans now to 127.
  21. //    A sensor seems to use address 120.
  22. // Version 6, November 27, 2015.
  23. //    Added waiting for the Leonardo serial communication.
  24. //
  25. //
  26. // This sketch tests the standard 7-bit addresses
  27. // Devices with higher bit address might not be seen properly.
  28. //
  29.  
  30. #include <Wire.h>
  31.  
  32.  
  33. void setup()
  34. {
  35.   Wire.begin();
  36.  
  37.   Serial.begin(9600);
  38.   while (!Serial);             // Leonardo: wait for serial monitor
  39.   Serial.println("\nI2C Scanner");
  40. }
  41.  
  42.  
  43. void loop()
  44. {
  45.   byte error, address;
  46.   int nDevices;
  47.  
  48.   Serial.println("Scanning...");
  49.  
  50.   nDevices = 0;
  51.   for(address = 1; address < 127; address++ )
  52.   {
  53.     // The i2c_scanner uses the return value of
  54.     // the Write.endTransmisstion to see if
  55.     // a device did acknowledge to the address.
  56.     Wire.beginTransmission(address);
  57.     error = Wire.endTransmission();
  58.  
  59.     if (error == 0)
  60.     {
  61.       Serial.print("I2C device found at address 0x");
  62.       if (address<16)
  63.         Serial.print("0");
  64.       Serial.print(address,HEX);
  65.       Serial.println("  !");
  66.  
  67.       nDevices++;
  68.     }
  69.     else if (error==4)
  70.     {
  71.       Serial.print("Unknown error at address 0x");
  72.       if (address<16)
  73.         Serial.print("0");
  74.       Serial.println(address,HEX);
  75.     }    
  76.   }
  77.   if (nDevices == 0)
  78.     Serial.println("No I2C devices found\n");
  79.   else
  80.     Serial.println("done\n");
  81.  
  82.   delay(5000);           // wait 5 seconds for next scan
  83. }
 
// ************************************
Another option is to hardwire the address.
This is useful if you have multiple devices. You can set a different I2C address so that
it doesn't conflict  with any other I2C devices.

The back of the module has these solder pads:

A0, A1, A2
Short these jumpers to set the address.
The jumpers take two inputs .. HIGH or LOW
We can create 8 (23) different combinations.
 
By default on Texas chips, all the 3 address inputs are pulled HIGH using onboard pullups, giving their PCF8574 a default I2C address of 0100111Binary or 0x27Hex.

  Ther three address selection bits (A0, A1 and A2) are placed at the end of the 7-bit I2C address register.
X,X,X,X,A0,A1,A2
 
On a NXP chip, 
all the 3 address inputs are pulled HIGH using onboard pullups, giving their PCF8574 a default I2C address of 0111111Binary or 0x3FHex.
 
*************************************** 

My LCD displays address was 0x3F

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
 // Change the 0x3F  i2c address to your i2c 
// LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);



 You need this library:
 
 The LiquidCrystal_I2C library works in combination with the Wire.h library which allows you to communicate with I2C devices.
 
// **********************************************************


 
//code 1..Hello World

// include the library code:
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
 // Change the 0x3F  i2c address to your i2c 
// LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

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

void loop() {
 
}
 
// **************************************************************** 
// Example 3
// hELLO synth nerds
// Moving text on the two lines:

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // set the LCD address to 0x3F for a 16 chars and 2 line display

void setup() {
    lcd.begin(16, 2);
  lcd.clear();         
  lcd.backlight();      // Make sure backlight is on
 
  // Print a message on both lines of the LCD.
  lcd.setCursor(2,0);   //Set cursor to character 2 on line 0
  lcd.print("Hello Synth");
 
  lcd.setCursor(5,1);   //Move cursor to character 5 on line 1
  lcd.print("Nerds !");
}

void loop() {
}
// *****************************************


Example 4 - creating symbols
I love synthesizers 1
 The heart symbol has been made with the online LCD symbol generator:
 https://maxpromer.github.io/LCD-Character-Creator/ 
 
// *********************************
 
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

byte heart[] = {
  0x00,
  0x0A,
  0x1F,
  0x1F,
  0x0E,
  0x04,
  0x00,
  0x00
};
 
void setup() {
 lcd.begin(16, 2);
  lcd.backlight();             // turn backlight on
  lcd.clear();                 // clear the screen

  lcd.createChar(1, heart);    // define a symbol for memory position 1
  lcd.setCursor(0, 1);         // set the cursor to position 1, line 2
  lcd.print("I ");           // write on the screen
  lcd.write(1);                // write symbol from memory position 1
  lcd.print(" Synthesizers"); // write on the screen
}
 
void loop() {}

// ***********************************
I love synthesizers 2
 The EQ symbol has been made with the online LCD symbol generator:
 https://maxpromer.github.io/LCD-Character-Creator/ 
 

 
 
// ********************************* 

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
// RS, E, D4, D5, D6, D7

byte customChar[] = {
  0x00,
  0x02,
  0x02,
  0x0A,
  0x0B,
  0x1B,
  0x1F,
  0x1F
};

void setup() {
 lcd.begin(16, 2);
  lcd.backlight();             // turn backlight on
  lcd.clear();                 // clear the screen

  lcd.createChar(1, customChar);    // define a symbol for memory position 1
  lcd.setCursor(0, 1);         // set the cursor to position 1, line 2
  lcd.print("I ");           // write on the screen
  lcd.write(1);                // write symbol from memory position 1
  lcd.print(" Synthesizers"); // write on the screen
}
 
void loop() {}



Links
 

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

Buchla 200 - Friday night patch

Just having fun with the 200.
That 296 filter is wonderful.

#buchla296 #programmable #spectral #processor #modularsynth #vintage

A post shared by jono (@dj_jondent) on




Micro Granny - Basl Instruments

Thanks Andrew for bringing this over

A post shared by jono (@dj_jondent) on
Its a monophonic granular sampler. It reads wav samples from microSD card and applies granular algorithms to them. You can also adjust start, end, sample rate (tuned or free run), crush and envelope (attack release).

It's all 8-bit.
Uses a microcontroller / Arduino platform.

Korg PS 3200

The lovely Sounds of the Korg Ps 3200

Andrew brought his Future Retro Zillion sequencer yesterday
so we decided to test it out on the Korg.

A post shared by jono (@dj_jondent) on

Wednesday, 29 March 2017

Buchla Preset card - DIY mixer for 208 easel

One of the best things about the Buchla Music Easel is its program card.
It's really not just for presets ... esp the original card invented by Don Buchla back in the 1970s.


I'm guessing he may have wanted us users to experiment with electronic circuits.
Why else would Don have placed a mini "breadboard" with +/- 15V rails on the program card?

The Buchla SILI-CON CELLO from 1978 is a good example of his use of breadboard circuits in a fully
functioning system. It's a shame the current BEMI program cards have removed this homage to the age of DIY electronics.

This is my latest use of the card: a DIY mixer.
(The 10U system doesn't have a dedicated mixer).

The circuit is very simple.
Just one dual op-amp (TL072)

It's a basic unity gain inverting configuration. In the first half the 4 inputs are mixed into the inverting input of a op-amp. Since the output signal from this op-amp is inverted, the 2nd op-amp  re-inverts it. 
Power goes to pins 4 & 8. The unmarked resistor on the right is 1K

Thanks to Ken Stone for the original circuit. and Justin from MetroModular for his advice.
Ken's schematics show the possibility for using this as a CV mixer & attenuverter.

Breadboarding the circuit. Just two inputs on the left without pots.
It works on +/-12V above and +/-15V below.

Might try building a mixer using the OPA2134.
It's pinout is the same as the TL072.

Saturday, 25 March 2017

Momentary push buttons - Turning a LED on with a button - arduino

Momentary push buttons
These are really common in arduino projects
 
  It's a basically 2 switches
 
The vertical leads are internally connected prior to pressing the button.
 
Pressing the button will close those switches at the top & bottom of the switch.
 
 
 
 
 
 

The circuit below, doesn't use any coding. The arduino board is simply a power supply.
 
 

 
 Code 1
This is a basic code using pulldown resistors and a switch.
It's a complicated way of turning a LED on.
The idea is to use software, rather than hardware to turn the switch on.
 
Black is ground.
Red is +5V
When the button is not pressed, the pin 2 is connected to ground (via the resistor).
Pin 2 thus reads LOW
When the button is pressed, Pin 2 is connected to +5V, and thus reads a HIGH.
 

Here is the code:
//----------------..........................................
/*
  Button

  Turns on and off a light emitting diode(LED) connected to digital pin 13,
  when pressing a pushbutton attached to pin 2.

  The circuit:
  - LED attached from pin 13 to ground
  - pushbutton attached to pin 2 from +5V
  - 10K resistor attached to pin 2 from ground

  - Note: on most Arduinos there is already an LED on the board
    attached to pin 13.

  created 2005
  by DojoDave <http://www.0j0.org>
  modified 30 Aug 2011
  by Tom Igoe

  This example code is in the public domain.

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

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 2;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}

 // -----------



Basic program # 2
Slightly different way to do the same thing.
 
 

The pushbutton is part of the pulldown resistor detection system

pin 9 reads either a HIGH or LOW signal. 
Its the input
When the button is not pressed, pin 9 is connected to 5V through the resistor... Thus HIGH.
Digital pins are instructed to stay LOW and don't put out 5V to light the LEDs.

When the button is pressed, the opposite occurs.

Here is the code
// ---------------------------------------------------------

int buttonstate = 0;

void setup()
{
  pinMode(9, INPUT);
  pinMode(13, OUTPUT);
  pinMode(6, OUTPUT);
}

void loop()
{
  buttonstate = digitalRead(9);
  if (buttonstate == HIGH) {
    // when not pressed the pull up resistor is on
    digitalWrite(13, LOW);
    digitalWrite(6, LOW);
  } else {
    // helpful single-line comment here
    digitalWrite(13, HIGH);
    digitalWrite(6, HIGH);
  }
  delay(10); // Delay a little bit to improve simulation performance
}
// -------------------------------------------------------

Superbooth - Berlin - Aussie Manufacturers





Oscillosaurus
https://www.facebook.com/oscillosaurus/

Golt!
https://www.facebook.com/skewy?hc_ref=SEARCH&fref=nf 
https://www.youtube.com/watch?v=M1oTKRkTU0o

Amalgamod
https://www.facebook.com/amalgamod/

Metromodular
http://metro-modular.com/ 
https://www.facebook.com/Metro.Modular/

NonlinearCircuits
http://www.nonlinearcircuits.com/

Beast-Tek
http://www.beast-tek.com/
https://www.facebook.com/BeastTek/

Worng Electronics
https://www.facebook.com/worngelectronics/

Cat Full Of Ghosts
https://www.facebook.com/cfogElectronics/?hc_ref=SEARCH&fref=nf
http://www.catfullofghosts.com/