Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: Anyone interested in a fast PWM in-phase/out of phase library? on: January 10, 2013, 01:21:23 pm
Concept is simple.  I wanted to create an AC type output from two PWM pins using the same timer (timer 1) at a very high speed.  The purpose is to create a higher sound pressure level output from a piezoelectric transducer than the standard pulsed-DC method used in the Tone library.  Basically, instead of a pulsed-DC +5v and 0v (5 volt range) signal, driving two pins out of phase yields an effective +5v and -5v (10 volt range).

The tone library won't work as it doesn't do in/out of phase (also may have high frequency issues when the ATmega is running at low speed).  The TimerOne library won't work because it also doesn't do in/out of phase PWM.

I couldn't find such a library, so I wrote a very fast port register level library that provides a perfect in-phase and out of phase PWM signal on two PWM pins.  On an Arduino Uno you would tie the piezoelectric buzzer to pins 9 and 10 and using my library specify the frequency and you're done.  Even if running the ATmega at 4 MHz like I was, this library can still create an ultrasonic frequency, and much louder than with the Tone library as it's driving both pins out of phase with each other.  It always keeps the duty at 50% for the highest output.

Anyway, did I miss a library that does this?  Or, is there interest in me turning it into a library for the community.  It wouldn't be difficult, but there's no reason to bother if no one is interested.  Think of it like a high-power and faster version of the Tone library but fixed to the assigned PWM pins for timer 1 (9 & 10 for Uno) (14 & 15 for Teensy 2.0) (11 & 12 for Mega).



Tim

While I don't have a project right now that would use it, why would anyone say no to a new useful library?

Yes...Yes..Yes...
2  Using Arduino / Displays / Re: Hacktronics 20x4 LCD Ripping my hair out ;repost with complete information. on: November 27, 2012, 04:54:12 pm
Just in the nick of time, I had one hair left. 
Thanks to your suggestions I went back to square one and tried to load Blink.  No luck loading Blink so I took a look at my com ports and I had 10+ of the darn things ranging into the high 20's.  On top of that apparently 1.0.2 does not warn if the com port was not found, or at least it did not with mine.  So going back to square one I confirmed which com port that Arduino was using and selected it from the menu and the darn thing uploaded and started working.  Talk about feeling like and idiot!  All is good with life again and I hope the rest of the hairs grow back.

Thanks for all the help...I learned an important lesson here.
3  Using Arduino / Displays / Re: Hacktronics 20x4 LCD Ripping my hair out ;repost with complete information. on: November 27, 2012, 02:28:26 pm
Serial monitor is empty for new (out of the box Arduino) with Sketch loaded.  Same with Arduino connected to the display and with the display removed (nothing in the serial monitor).

I will try to upload blinky and see what happens.    I will also try different machine to upload.

Still tearing out my hair...not many left!
4  Using Arduino / Displays / Re: Hacktronics 20x4 LCD Ripping my hair out ;repost with complete information. on: November 27, 2012, 01:06:40 pm
Display disconnected, tried power from wall wart on two different Arduino UNO R3's with same results. While I am a newbie at this I have completed several projects, one using an LCD shield, lots of LED projects, one wire i2c temperature sensors and two wire i2c for LCD.  Normally I can figure it out within a few hours using sample code or looking around the internet.  This one has me stumped and I have three of these things to be used for pending projects. 

Thanks for the help so far.

What next?
5  Using Arduino / Displays / Hacktronics 20x4 LCD Ripping my hair out ;repost with complete information. on: November 27, 2012, 12:48:46 pm
Repost...not sure why the first one posted before I was done.
I have been ripping my hair out for three days trying to get the Hacktronics 20x4 LCD to work in 4 bit mode. Here is the pin config that they recommend

1 (VSS) to GND Arduino pin*
2 (VDD) to + 5v Arduino pin
3 (contrast) to potentiometer to GND Arduino pin*
4 RS to Arduino pin 12
5 R/W to Arduino pin 11
6 Enable to Arduino pin 10
7 No connection
8 No connection
9 No connection
10 No connection
11 (Data 4) to Arduino pin 5
12 (Data 5) to Arduino pin 4
13 (Data 6) to Arduino pin 3
14 (Data 7) to Arduino pin 2
15 Backlight to Resistor to Arduino pin 13**
16 Backlight GND to GND Arduino pin*
This is the demo sketch that I am using
// character LCD example code
// www.hacktronics.com

#include <LiquidCrystal.h>

// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

int backLight = 13;    // pin 13 will control the backlight

void setup()
{
  pinMode(backLight, OUTPUT);
  digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
  lcd.begin(20,4);              // columns, rows.  use 16,2 for a 16x2 LCD, etc.
  lcd.clear();                  // start with a blank screen
  lcd.setCursor(0,0);           // set cursor to column 0, row 0 (the first row)
  lcd.print("Hello, World");    // change this text to whatever you like. keep it clean.
  lcd.setCursor(0,1);           // set cursor to column 0, row 1
  lcd.print("hacktronics.com");
 
  // if you have a 4 row LCD, uncomment these lines to write to the bottom rows
  // and change the lcd.begin() statement above.
  //lcd.setCursor(0,2);         // set cursor to column 0, row 2
  //lcd.print("Row 3");
  //lcd.setCursor(0,3);         // set cursor to column 0, row 3
  //lcd.print("Row 4");
}

void loop()
{
}


Problem is that no characters are displayed and the backlight flashes on and off (like Blinky) along with onboard LED  Moved backlight to +5 with resistor solving that problem.  Contrast works fine.  I get two lines of square boxed even though sketch set to 20x4.  Program complies fine with no errors however when uploading to Ardunio UNO R3 I get the following message in lower box of compiler " Binary Sketch.........(of a 32.256 byte maximum)  avrdude: stk500_getsync() : not in sync: resp=0x00"

I have soldered the pins to the LCD and pushed them into the breadboard.  I have tripple checked the wiring.  No matter what I do I have the same problem plus the LED on pin 13 continues to blink.  Thinking I might have damaged or miswired something I loaded the Sketch onto a brand new Arduino UNO R3 (not attached to the LCD) and got the same blinking LED.  Since there is nothing in the Void Loop why is the LED flashing?
This morning I updated the Arduino compiler to 1.0.2 and tried the example sketch changing the wiring to match that sketch....same exact problem.
HELP!
Please be gental with me I am an old guy and can't take much more ;-)

Thanks
Allen
6  Using Arduino / Displays / Re: SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno on: November 22, 2012, 01:06:04 pm
I had same problem reported by others using the SainSmart examples and libraries.  Finally found this and followed Andrew's advice and now it works!  Must agree with displayed message.

Thanks guys!
Pages: [1]