Show Posts
Pages: [1] 2 3 ... 10
1  Using Arduino / Networking, Protocols, and Devices / Re: ATtiny85 SoftSerial, takes a while to stablise? on: March 27, 2013, 09:31:52 am
Yeah I'm selecting ATtiny85 (internal 8Mhz Clock) from the boards menu. Thanks for the link, although I would like a solution that will not involve so much calibration since I plan to use a lot of ATiny85's! (or similar)
2  Using Arduino / Networking, Protocols, and Devices / Re: ATtiny85 SoftSerial, takes a while to stablise? on: March 27, 2013, 09:12:34 am
Yeah same behavior with that delay. Another example showing weird behavior:

Mega:
Code:
const int led=13;

void setup()
{
pinMode(led, OUTPUT);
Serial.begin(4800);
Serial1.begin(4800);
delay(100);
}

void loop()
{
if (Serial1.available() > 0)
{
char c = Serial1.read();
Serial.println(c);
}
digitalWrite(led, HIGH);
Serial1.print("hello");
delay(50);
digitalWrite(led, LOW);
delay(50);
}

85:
Code:
#include <SoftwareSerial.h>
const int rx=2;
const int tx=3;
const int led=0;

SoftwareSerial mySerial(rx, tx);

void setup()
{
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
  pinMode(led,OUTPUT);
  mySerial.begin(4800);
  delay(100);
}
 
void loop()
{
  if (mySerial.available()>0)
  {
     digitalWrite(led, HIGH);
     char c = mySerial.read();
     mySerial.print(c);
   }
   
   digitalWrite(led, LOW);
}

Arduino Serial Monitor
Code:
h
Ø
±
½
ÿ
h
Ø
±
½
ÿ
h
Ø
±
½
ÿ
h
¸
±
½
ÿ
h
Ø
±
½
ÿ
h
Ø
±
½
ÿ
h
Ø
±
½
ÿ
h
Ø
±
½
ÿ
h
Ø
±
½
ÿ
h
Ø
±
½
ÿ
h
¸
±
½
ÿ
h
Ø
±
½
ÿ
h
˜
±
½
ÿ
h
Ø
±
½
ÿ
h
Ø
±
½
ÿ
h
Ø
±
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
h
e
l
l
o
h
e
l
l
o
h
e
l
l
o
h
e
l
l
o
h
e
l
l
o
h
e
l
l
o
h
e
l
l
o
h
e
l
l
o
h
e
l
l
o
h
e
l
l
o
3  Using Arduino / Networking, Protocols, and Devices / Re: ATtiny85 SoftSerial, takes a while to stablise? on: March 27, 2013, 07:53:40 am
You send an "a". The 85 sends back "a<cr><lf>". Why?

Well spotted thanks.

So I guess my question changes to: Why does the 85 start by sending "a<cr><lf>", but then changes to just "a<cr>" ?
4  Using Arduino / Networking, Protocols, and Devices / ATtiny85 SoftSerial, takes a while to stablise? on: March 27, 2013, 07:25:20 am
I'm experimenting with Serial communication with an ATtiny85 and the SoftwareSerial Library, this simple example kind of works but only after a few seconds. To begin with the ATtiny only seems to respond correctly around 50% of the time, but after a couple of seconds it  functions correctly. Take this example code, which simply sends the character "a" to the Attiny, which echoes it back to the Mega, which then echos it to the PC:

Arduino Mega:
Code:
void setup()
{
Serial.begin(4800);
Serial1.begin(4800);
}

void loop()
{
if (Serial1.available() > 0)
{
char c = Serial1.read();
Serial.println(c);
}

Serial1.print("a");
delay(100);
}

ATtiny85
Code:
#include <SoftwareSerial.h>
const int rx=2;
const int tx=3;
const int led=0;

SoftwareSerial mySerial(rx, tx);

void setup()
{
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
  pinMode(led,OUTPUT);
  mySerial.begin(4800);
}
 
void loop()
{
  if (mySerial.available()>0)
  {
     digitalWrite(led, HIGH);
     char c = mySerial.read();
     mySerial.println(c);
   }
   
   digitalWrite(led, LOW);
}

Then on  the serial monitor I might see something like this:
Code:
a



a



a


?


a



a



a



a



a



a
a
a
a
a
a
a

Where as I would expect just:
Code:
a
a
a
a
a
a
a
a

Any thoughts as to why this happens?
5  Using Arduino / LEDs and Multiplexing / Re: PWM Led drivers which source current? on: February 28, 2013, 11:21:13 am
http://www.onsemi.com/pub_link/Collateral/NSI50350AS-D.PDF
Circuit follows the device's data sheet, except for C11.

I was advised elsewhere to add C11 to reduce any EMI effects (also mentioned in the data sheet), as the rest of the circuit is a touch sensor.

I was confused when you said this was a "built" circuit. I thought you couldn't modify it.

C11 is preventing you from using the BJT for PWM control. If you remove C11 you can connect a PWM signal to the base of Q2 (any current sink chip will do the job - just place a smallish resistor between Vcc and the chip input and connect the base of Q2 to the resistor).

EMI effects? They're almost inevitable in a PWM circuit. You'll need to add lots of decoupling and maybe try different PWM frequencies to minimize them.


Built as in my PCB's are fabricated and populated... but I could replace C or R with other values.

The circuit works fine with C11? (should it not?) I have it connected to a PWM output on an arduino. Now I will try connecting it up to a current sink chip with a pull up resistor - hopefully this will work too!

6  Using Arduino / LEDs and Multiplexing / Re: PWM Led drivers which source current? on: February 28, 2013, 10:03:01 am
http://www.onsemi.com/pub_link/Collateral/NSI50350AS-D.PDF
Circuit follows the device's data sheet, except for C11.

I was advised elsewhere to add C11 to reduce any EMI effects (also mentioned in the data sheet), as the rest of the circuit is a touch sensor.
7  Using Arduino / LEDs and Multiplexing / Re: PWM Led drivers which source current? on: February 28, 2013, 09:58:01 am
If the current-sinking PWM driver you like has open-collector (or open-drain) outputs you can use pull-up resistors (to 5V) to turn those output into 5V logic outputs.  When the output is off the pull-up resistor will take the signal HIGH.  When the output is on it will pull the signal LOW.

That sounds like a great solution, how do I work out the optimum pull-up value?

Do you have a datasheet or link to that CCR2 device? Most constant current driver devices have active outputs and would not work the way you are attempting to PWM it.

Lefty

The circuit is taken from the figure 11 in the datasheet: http://www.onsemi.com/pub_link/Collateral/NSI50350AS-D.PDF
8  Using Arduino / LEDs and Multiplexing / PWM Led drivers which source current? on: February 28, 2013, 04:38:03 am
Are there any PWM LED drivers that source current in a similar way to the PWM outputs on the Arduino?

I need to drive 30 LEDs (10 RGB) on my LED driver boards (which are made, example below), and consist of a high current BJT switching circuit. Therefore I need to drive the base of the transistor with 0 - 5v.

All the IC's I have found are current sink. Any advice would be greatly appreciated!
9  Using Arduino / General Electronics / Re: Strange behavior when setting Outputs affecting Input. on: January 03, 2013, 09:48:34 am
Think I've got it sorted...,

I need to reset the touch IC, after all the rest of the electronics have powered up. 2 days of troubleshooting - how did I miss that!
10  Using Arduino / General Electronics / [Solved] Strange behavior when setting Outputs affecting Input. on: January 03, 2013, 06:50:26 am
Attached is a schematic of my circuit: a touch sensor using an Atmel AT42QT1010, and 2 constant current LED drivers. I have 10 of these circuits connected to power and an Arduino Mega, via P2.

The problem seems to occur by connecting pins 2 & 4 on P2 to the MC. Even when these are set to LOW, setting these pins HIGH on the other units will affect this one, causing the OUT of AT42QT1010 to go HIGH. This seems to happen when I set more than 3 of LEDs to HIGH (on any other circuit), in fact as soon as I do that, every device reports its Touch OUT to be HIGH...

Any advice to how I could remedy this would be great... I'm truly stuck! I really cant think of anything else to try.
11  Using Arduino / Programming Questions / Re: Why can't I compile the AtTouch Library on: December 10, 2012, 12:16:07 pm
So in AtTouch.h, I've tried replacing

Code:
#include "WProgram.h"

with
Code:
#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif

and also tried
Code:
#include <Arduino.h>

But I still get the errors, I'm sure this must be simple... What else could I be doing wrong??
12  Using Arduino / Programming Questions / Re: Why can't I compile the AtTouch Library on: December 10, 2012, 11:35:55 am
Thanks, that cleared up a lot of errors but there are still some remaining - any more suggestions?

Code:
In file included from AtTouch_press.ino:11:
AtTouch.h:62: error: 'boolean' has not been declared
AtTouch.h:80: error: 'boolean' does not name a type
AtTouch.h:125: error: 'boolean' does not name a type
AtTouch.h:131: error: 'byte' does not name a type
AtTouch.h:132: error: 'byte' does not name a type
AtTouch.h:133: error: 'boolean' does not name a type
AtTouch.h:135: error: 'byte' does not name a type
AtTouch.h:136: error: 'boolean' does not name a type
AtTouch_press.ino: In function 'void loop()':
AtTouch_press:38: error: 'class AtTouch' has no member named 'hit'
13  Using Arduino / Programming Questions / Why can't I compile the AtTouch Library on: December 07, 2012, 10:57:29 am
I'm trying to use the AtTouch Library:
https://github.com/slugmobile/AtTouch
http://n0m1.com/2011/08/01/attouch-library-for-arduino-and-the-at42qt1070/

When I compile the included example AtTouch_press - I get a ton of errors, included below.

Has the IDE changed since this library was released, Is something up with my system?

Code:
In file included from AtTouch.cpp:29:
AtTouch.h:62: error: 'boolean' has not been declared
AtTouch.h:80: error: 'boolean' does not name a type
AtTouch.h:125: error: 'boolean' does not name a type
AtTouch.h:131: error: 'byte' does not name a type
AtTouch.h:132: error: 'byte' does not name a type
AtTouch.h:133: error: 'boolean' does not name a type
AtTouch.h:135: error: 'byte' does not name a type
AtTouch.h:136: error: 'boolean' does not name a type
AtTouch.cpp:49: error: 'boolean' has not been declared
AtTouch.cpp: In member function 'void AtTouch::begin(int, int)':
AtTouch.cpp:51: error: '_changePin' was not declared in this scope
AtTouch.cpp:51: error: 'byte' was not declared in this scope
AtTouch.cpp:51: error: expected `;' before 'interruptPin'
AtTouch.cpp:52: error: '_interruptVal' was not declared in this scope
AtTouch.cpp:52: error: expected `;' before 'interruptPin'
AtTouch.cpp:54: error: 'keyHit' was not declared in this scope
AtTouch.cpp:55: error: 'holdDown_' was not declared in this scope
AtTouch.cpp:64: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

AtTouch.cpp:65: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

AtTouch.cpp:67: error: 'delay' was not declared in this scope
AtTouch.cpp:91: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

AtTouch.cpp:92: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

AtTouch.cpp:103: error: 'INPUT' was not declared in this scope
AtTouch.cpp:103: error: 'pinMode' was not declared in this scope
AtTouch.cpp:104: error: 'FALLING' was not declared in this scope
AtTouch.cpp:104: error: 'attachInterrupt' was not declared in this scope
AtTouch.cpp: At global scope:
AtTouch.cpp:113: error: 'boolean' does not name a type
AtTouch.cpp: In member function 'void AtTouch::update()':
AtTouch.cpp:146: error: 'keyHit' was not declared in this scope
AtTouch.cpp:148: error: 'activeKey_' was not declared in this scope
AtTouch.cpp: In member function 'int AtTouch::getKey()':
AtTouch.cpp:160: error: 'activeKey_' was not declared in this scope
AtTouch.cpp: In member function 'int AtTouch::readActiveKey()':
AtTouch.cpp:180: error: 'activeKey_' was not declared in this scope
AtTouch.cpp:180: error: 'byte' was not declared in this scope
AtTouch.cpp:180: error: expected `;' before 'keyValue'
AtTouch.cpp:181: error: 'holdDown_' was not declared in this scope
AtTouch.cpp: In member function 'int AtTouch::readActiveAddress()':
AtTouch.cpp:195: error: 'keyHit' was not declared in this scope
AtTouch.cpp:209: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

AtTouch.cpp:212: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

AtTouch.cpp:215: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

AtTouch.cpp:218: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

AtTouch.cpp: At global scope:
AtTouch.cpp:261: error: 'boolean' does not name a type
AtTouch.cpp: In function 'void bttnPressISR()':
AtTouch.cpp:303: error: 'class AtTouch' has no member named 'keyHit'
AtTouch.cpp:304: error: 'class AtTouch' has no member named 'holdDown_'
AtTouch.cpp:305: error: 'millis' was not declared in this scope
14  Using Arduino / General Electronics / Re: PWM EMI capacitor - How to work out the value? on: December 06, 2012, 11:11:27 am
If EMI was an issue, what equation would I use to work out C?
15  Using Arduino / Networking, Protocols, and Devices / Re: RS485 Switch the termination resistor on: December 05, 2012, 03:39:00 pm
Yes that's the kind of thing I was thinking, just wasn't sure of the 'correct' way to accomplish it.
Thanks for DG418 tip!
Pages: [1] 2 3 ... 10