Show Posts
Pages: [1] 2 3 ... 9
1  Using Arduino / Networking, Protocols, and Devices / Re: Attiny85 Peculiar I2C Problem on: March 10, 2014, 03:22:27 pm
Im also trying to get an attiny to read from the mpu6050; there is example code on the playground you use with the larger arduinos and it uses Wire.h, does anyone know how to transcribe the read write and error functions to match the TinyWire Libraries?

This is a link to my other question with the sample code. thanks

http://forum.arduino.cc/index.php?topic=224702
2  Using Arduino / Microcontrollers / Re: Attiny85 and MPU-6050 on: March 10, 2014, 09:44:52 am
yes, the example sketch was written for the full size arduinos and I was trying to get the sensor to work on my attiny85. There are memory limitations as i understand it and not all the methods from the two libraries are the same, yet they accomplish the same thing. I was wondering if someone could transcribe these functions to work with the tiny85.

Thanks
3  Using Arduino / Microcontrollers / Re: Attiny85 and MPU-6050 on: March 10, 2014, 08:41:00 am
What exactly is the problem?

Error messages...?


Wire.h doesnt compile for the ATTiny85.
4  Using Arduino / Microcontrollers / Re: Attiny85 and MPU-6050 on: March 09, 2014, 09:10:05 pm
The example sketch is using Wire and I need to use TinyWireM/TinyWireS.
5  Using Arduino / Microcontrollers / Attiny85 and MPU-6050 on: March 09, 2014, 07:48:43 pm
I have some code working on my ...milenove, and wanted to "transcribe" the project to an 85.

I got an 20x4 lcd working on the i2c bus, and I wanted to add the MPU. The problem I'm having is translating the MPU-read and write functions from the Wire Library to TinyWireM/TinyWireS

Here is the code:
Code:
// --------------------------------------------------------
// MPU6050_read
//
// This is a common function to read multiple bytes
// from an I2C device.
//
// It uses the boolean parameter for Wire.endTransMission()
// to be able to hold or release the I2C-bus.
// This is implemented in Arduino 1.0.1.
//
// Only this function is used to read.
// There is no function for a single byte.
//
int MPU6050_read(int start, uint8_t *buffer, int size)
{
  int i, n, error;

  Wire.beginTransmission(MPU6050_I2C_ADDRESS);
  n = Wire.write(start);
  if (n != 1)
    return (-10);

  n = Wire.endTransmission(false);    // hold the I2C-bus
  if (n != 0)
    return (n);

  // Third parameter is true: relase I2C-bus after data is read.
  Wire.requestFrom(MPU6050_I2C_ADDRESS, size, true);
  i = 0;
  while(Wire.available() && i<size)
  {
    buffer[i++]=Wire.read();
  }
  if ( i != size)
    return (-11);

  return (0);  // return : no error
}


// --------------------------------------------------------
// MPU6050_write
//
// This is a common function to write multiple bytes to an I2C device.
//
// If only a single register is written,
// use the function MPU_6050_write_reg().
//
// Parameters:
//   start : Start address, use a define for the register
//   pData : A pointer to the data to write.
//   size  : The number of bytes to write.
//
// If only a single register is written, a pointer
// to the data has to be used, and the size is
// a single byte:
//   int data = 0;        // the data to write
//   MPU6050_write (MPU6050_PWR_MGMT_1, &c, 1);
//
int MPU6050_write(int start, const uint8_t *pData, int size)
{
  int n, error;

  Wire.beginTransmission(MPU6050_I2C_ADDRESS);
  n = Wire.write(start);        // write the start address
  if (n != 1)
    return (-20);

  n = Wire.write(pData, size);  // write data bytes
  if (n != size)
    return (-21);

  error = Wire.endTransmission(true); // release the I2C-bus
  if (error != 0)
    return (error);

  return (0);         // return : no error
}

// --------------------------------------------------------
// MPU6050_write_reg
//
// An extra function to write a single register.
// It is just a wrapper around the MPU_6050_write()
// function, and it is only a convenient function
// to make it easier to write a single register.
//
int MPU6050_write_reg(int reg, uint8_t data)
{
  int error;

  error = MPU6050_write(reg, &data, 1);

  return (error);
}


I had to cut some of my added code out, to achieve the char limit of the post
Thanks in advance for your help.-Keith
6  Using Arduino / Microcontrollers / Re: LCD 20x4 on ATTiny85 I2C problems on: March 09, 2014, 07:32:17 pm
Guys, I got my new 20x4 LCD working on the attiny85 (see attachment). I first had to burn the bootloader to the chip and use the 1Mhz core, Then used the  example code  from this Library (changed my address after using the i2c_scanner and my row count):

http://playground.arduino.cc/uploads/Code/LiquidCrystal_I2C_85V1.zip

@Smithy I'll try that soon (I have a feeling that it wont work - I think the LCD might be damaged in some way).

Thanks for all your help
Keith
7  Using Arduino / Microcontrollers / Re: LCD 20x4 on ATTiny85 I2C problems on: March 07, 2014, 09:32:58 am
Did you use external pullup resistors? The internal are too weak on the ATtiny. Some I2C LCD adapter modules do not have them at all and require external.

Please see https://github.com/mikaelpatel/Cosa/issues/86


More info on http://cosa-arduino.blogspot.se/2013/07/object-oriented-lcd-management.html

Cheers!


Thanks for the info!
 do you have a simple sample sketch?
When working with the 85 do you call pin 5 or Pin 0?

Thanks again for your help
8  Using Arduino / Microcontrollers / Re: LCD 20x4 on ATTiny85 I2C problems on: March 06, 2014, 06:08:33 pm
there is  no brand on the other one
9  Using Arduino / Microcontrollers / Re: LCD 20x4 on ATTiny85 I2C problems on: March 06, 2014, 04:40:50 pm
the two init(); are in the example. I thought it was weird too...

in any case i just got another SainSmart 20x4 in the mail (just now); hooked it up and it works fine.

is there a way to fix the other one? replace a resister/component?
10  Using Arduino / Microcontrollers / Re: LCD 20x4 on ATTiny85 I2C problems on: March 06, 2014, 11:55:20 am
This is my code and attached is the output.

Code:
//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  lcd.print("Hello, world!");
  lcd.setCursor(2,1);
  lcd.print("Ywrobot Arduino!");
   lcd.setCursor(0,2);
  lcd.print("Arduino LCM IIC 2004");
   lcd.setCursor(2,3);
  lcd.print("Power By Ec-yuan!");
}


void loop()
{
}
11  Using Arduino / Microcontrollers / Re: LCD 20x4 on ATTiny85 I2C problems on: March 04, 2014, 07:42:22 pm
ok the chinese library worked for my ...milenove, but the char display acts as a 16x2 and not a 20x4 even is i try to print to the other char positions the 16x2 positions only print...

my address is 0x27 according to the i2c_scanner.

any suggestions on how to use the full display?
12  Using Arduino / Microcontrollers / Re: LCD 20x4 on ATTiny85 I2C problems on: February 21, 2014, 12:34:43 pm

This is the first article I read and the first library I downloaded. No luck! Thanks though
13  Using Arduino / Microcontrollers / LCD 20x4 on ATTiny85 I2C problems on: February 20, 2014, 03:04:14 pm
Can some one tell me how to setup an ATiny85v to run a 20x4 LCD with an LCM1602 IIC V1 backpack?

I've downloaded and tried about 6 different Libraries. None seem to work.

SDA = Attiny85 pin 5 with pull up
SCL =  Attiny85 pin 7 with pull up
VCC = pin 8
GND = pin4

One of the problems is I don't know the I2c address and I cant seem to run the scanner on the tiny. When I setup the display on a Nano or a DueMilenove the address is 0x27. the backpack is running a PCF8574T.

Do I have to set any fuses or anything special first?

I've been googling and reading this forum all day and nothing seems to work for me. Any suggestions?

Thanks for your  help.
14  Using Arduino / Networking, Protocols, and Devices / Re: OptoIsolator - Using a transistor to control a 6 pin dip relay? on: December 12, 2013, 01:54:04 pm
when i measure the amps from the pin to gnd i get 39mA.

The arduino seems to reset if i trigger three pins. is there any way to trigger 6 pins/relays or some combination, keeping the max power draw to <50mA?
15  Using Arduino / Networking, Protocols, and Devices / Re: OptoIsolator - Using a transistor to control a 6 pin dip relay? on: December 11, 2013, 11:30:53 am
So you will have power & gnd connected to the servos all the time, and only disconnect the servo control line? Yes, that will work.

yes, great! I'll try this tonight.
Pages: [1] 2 3 ... 9