Show Posts
Pages: [1] 2
1  Using Arduino / Sensors / Re: TMP36 Brownout possibley killed it on: December 14, 2012, 04:09:33 pm
hello
if you look at the datasheet of the tmp36, you can observe that it is very sensitive to electrostatic fields other device. and requires a electrical stability. So I think the bateries is not the best solution. to have less interference with other equipment, you can add a ceramic capacitor 0.1 uf in parallel and add a resistor of 750 owm on the analog pin tmp36

good luck!

Emmanuelle

Think you hit the nail on the head there.

I did not have a 0.1uF ceramic, but instead a 10uF elecrolitic from another project. I think the fact that I have neglected the decoupling capacitors and this was causing a fluctuation (noticeable on the meter). One day I'll fix the scope.

After putting this across the main +- feed, this cured the readings...

Still just to work on a battery meeter now, but thats half the battle done now.

Many thanks for the help lesson learnt here is to use decoupling capacitors for everything. lol

Jimmy
2  Using Arduino / Sensors / Re: TMP36 Brownout possibley killed it on: December 12, 2012, 05:51:21 pm
Cheers for the replies.

Not had chance to have a look today, was a bad day at work and minecraft got the better of me, Amazing how something so simple can be so time consuming. Got in at 6, just realised the time and off to be lol

Will check this out tomorrow, but in the meen time, only things different are that the batteries went super flat (for the TMP36) and I put new ones, in, nothing else has changed.

I burned the sketch to another mcu and it made no difference, ut will try through a resistor as Riddick says.

Cheers once again.

Jimmy
3  Using Arduino / Sensors / Re: TMP36 Brownout possibley killed it on: December 12, 2012, 08:34:35 am
When I took the TMP36 from the circuit and made a 3V battery pack (2x AA batteires) I got a reading of 0.665V which I get to around 21 degrees which is fine.

When I put it back in circuit, at around 4V I get much lower readings and at 3.3V I get lower still.

This really confuses me now.

I have ordered some more, but a little upset that I seem to have killed this one.

Tonight, I will try taking out the Microprocessor and all the other bits and try just on its own incase it is just very sensative, but I have not come accross this in the year or so I have been playing.

Cheers anyway...

Jimmy
4  Using Arduino / Sensors / Re: TMP36 Brownout possibley killed it on: December 11, 2012, 07:51:52 pm
Update...

Just having a little more of a play, the arduino (using LadyAda's example) is showing a readout of 0.38V and the meter is giving 384mV, so code is good, got to be TMP36 then.
5  Using Arduino / Sensors / TMP36 Brownout possibley killed it on: December 11, 2012, 07:13:54 pm
I have a simple temperature / light monitor that worked quite well on one arduino, so i added a breadboard design and an RF transmitter and receiver so one ATmega328 was talking to another wirelessly.

I got this working reasonably well  for a little while until I decided to try some batteries instead of a 5V supply.

I used 4 AA batteries (6V average) but used a 3.3V regulator to tie the voltage to a nice stable one. This worked fine for a couple of days until I notice that my Cosm feed had nothing in it one morning (this morning). So I metered the battery pack and it was around 2.5V

A fresh set of batteries got the ardunio chip up and running again, but it started giving odd readings from the TMP36.

At first didnt think anything of it (on testing frozen to -25 the warm up curve is quite slow), but after it was running for an hour or so it was still reading between -11 and -7.

All code has remained the same so I know it is not that, I have tried a further ATMEGA and put this sketch on it and am now confused.

The reading of the TMP36 from a meter is 0.206mV and the reading of the ground line is 0.000V so is a good clean line. To me it looks like the voltage supplied was below the minimum voltage for it and has caused an issue with it. Unfortunately I do not have another to play with, so unable to check, but is this common?

If so what is the best way to monitor a battery voltage to turn off the supply to the TMP36 for the future?

I have thought of using a potential dividor to set the *fresh* battery voltage to just above 4.6V, tieing ARef to a 5V (not sure how to make as would need to be very low drop) supply and then monitoring this, but not sure if monitoring a battery voltage greater than the Vcc would be a good idea. Very confused here, but this is a 2nd point.

Any ideas are welcomed.

Jimmy

Edit, cosm feed is as below (will last around 6 days before new data pushes it out...
6  Using Arduino / Installation & Troubleshooting / Asking for a pointer Install FTDI driver on Headless pox. on: October 02, 2012, 11:58:21 am
I have a seagate Goflex home, with full root privledges.

I am wanting to attach the Arduino UNO purely for the Serial communcation of it.

I know the GOflex has a native Serial port on the inside, but this requires opening up the unit and soldering wires or whatever, and its a nice shiny box :lol:

However, I just want to download and install the FTDI drivers so I can communicate with a the unit as this is connected to my homje network at all times and I can use the features of the GoFlex home to sort it.

Details of the GOFlex is that it is is just a NAS drive, runs RedHat linux (embedded) and is a cut down version. There is the option to get root on it and I can access through putty / SSH, but it is totally headless, so I am not interested in installing the full UNO IDE.

Any ideas how to start this?

Jimmy
7  Using Arduino / Project Guidance / Re: Running out of Sram / program hang. on: April 29, 2012, 12:58:06 pm
What size pull-up resistors on the I2C lines?

These are using 4.7K ohm as per the datasheet, so stumped on that.

Twisting wires together doesn't cancel interference unless those two wires carry equal-but-opposite signals that are fed to a balanced input.  AFAIK, it can only hurt as the signals may then couple to each other.

Also, I would refactor your module like so:

Code:
char data[8];  // Forget _d0-_d7

uint8_t Maxim6955::write(uint8_t chr) {
 
  Wire.beginTransmission(_address);
  Wire.write(0x20);
 
  // Shift values back one digit, writing along the way to save a second loop
  for (uint8_t i = 1; i < 8; i++) {
    Wire.write(data[i]);
    data[i-1] = data[i];
  }
 
  // Shift in new char and write it
  data[7] = chr;
  Wire.write(chr);
 
  Wire.endTransmission();
 
  // Return an error code if you have one...
  return (TWI_error_code);
}


// Print C-style strings
uint8_t Max6955::print(char *str) {
  uint8_t i = 0;
  uint8_t ret;

  // Loop through C-style string and write each char
  while (str[i] != 0x00) {
    ret = write(str[i]);
    if (ret != 0) break;
  }
 
  // Pass along any errors
  return ret;
}

// Overload print for C++ strings
uint8_t Max6955::print(String str) {
  // Loop through string chars one at a time, calling write(char) for each
  // Return error code from write(char) if != 0
}

// You may wish to overload print for ints, floats, etc.  Up to you.

// Call print with 8 spaces
uint8_t Max6955::clear() {
  return print("        ");
}

I'm a C guy, so I'm not totally up to speed on C++ .. at least, the finer details of classes.  I'm halfway through a book, but not ready to write my own code here, so you'll have to fill in the details on the C++ String handling, and any errors I made on calling conventions within a namespace.

Many thanks I will try with untwisted wires and get back, if it makes a differnece, with regards to the code, it makes little sence to me, I wrote that a while ago, over a coupke of days of bodging some together, will give it a try though and see if it helps  smiley-grin

Jimmy
8  Using Arduino / Project Guidance / Re: Running out of Sram / program hang. on: April 27, 2012, 01:47:15 am
Quote
That is possible, so how would I find this, first instinct would be to add a Serial.print() in the library for Wire, but while I was writing my own I could not fathom how to get this to work, but will see what I can do.

ok, I have had a quick look through the twi.c file and found the function twi_writeTo()

This returns a number depending on what its sucsess is:

 * Output   0 .. success
 *             1 .. length to long for buffer
 *             2 .. address send, NACK received
 *             3 .. data send, NACK received
 *             4 .. other twi error (lost bus arbitration, bus error, ..)

on my serial out I got a 4 when it hangs, so this is a problem with the bus then? so either my wires, breadboard or the connections in the Arduino / max breakout board I think.

I have twisted the data and the clock wires together to hopefully cancel out interferance, but this dont seem to work, other than soldering to the boards, I'm at a loss as to a better option.
9  Using Arduino / Project Guidance / Re: Running out of Sram / program hang. on: April 26, 2012, 11:53:05 pm
None of these need to be ints. In fact, most of them look like they should be chars.

No problem - I'll change these over and report back

I'd look elsewhere for the problem, like a failure to communicate between the Arduino and the I2C device - like a Wire function waiting forever.

That is possible, so how would I find this, first instinct would be to add a Serial.print() in the library for Wire, but while I was writing my own I could not fathom how to get this to work, but will see what I can do.

Quote
Finally, if I enable the serial output, it stops sending serial data when it hangs also.
Which is where?

in the show() command of the 2nd example there is the block of
Code:
////////////////////////
  //    serial debug    // 
  ////////////////////////
  Serial.print(char(digit0));
  Serial.print(char(digit1));
  Serial.print(char(digit2));
  Serial.print(char(digit3));
  Serial.print(char(digit4));
  Serial.print(char(digit5));
  Serial.print(char(digit6));
  Serial.println(char(digit7));
 
  /////////////////////////
  //  end serial debug   //
  /////////////////////////

I may have been better describing it as ther serial debug hangs.

Many thanks for the feedback so far though and any further ideas welcomed.

Once I get this sorted, I can make some real progress with the project.

Jimmy
10  Using Arduino / Project Guidance / Re: Running out of Sram / program hang. on: April 26, 2012, 12:37:06 am
Cheers, I never know where to put anything in the forum.

First I'll add my libary which I have adapted from the Liquid Crystall Libary

MAX6955.h
Code:
//max6955.h
#ifndef Maxim
#define Maxim

#include "arduino.h"
#include <inttypes.h>
#include "Print.h"


class Maxim6955 : public Print {
 public:
   Maxim6955(uint8_t address); //constructor
   void begin(uint8_t test);
   void clear();

   virtual size_t write(uint8_t);
   using Print::write;

 private:
   void send(uint8_t);
   //void writeI2C();
   uint8_t _address;
   uint8_t _off;
   uint8_t _holder;
   uint8_t _string;
   uint8_t _d0;
   uint8_t _d1;
   uint8_t _d2;
   uint8_t _d3;
   uint8_t _d4;
   uint8_t _d5;
   uint8_t _d6;
   uint8_t _d7;
};

#endif


MAX6955.cpp

Code:
//max6955.cpp

#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <Wire.h>
#include "Arduino.h"
#include "max6955.h"

Maxim6955::Maxim6955(uint8_t address) {
  _address = address;
  _off = 0x00;
}

void Maxim6955::begin(uint8_t testMode) {
  //start configuring the display
  Wire.beginTransmission(_address);
  Wire.write(0x01);        // Write to the decode resgister;
  Wire.write(0b11111111); //decode all digits 1 is decode 0 gives direct access
  Wire.write(0x01);       //Intensity default, guess I should take this from a pin to see where the dash lights are at...
  Wire.write(0x07);       // hex easiest way of seeing which digits to scan (all 8 is 0x07)
  Wire.write(0x01);       // Control Reg 0x01 is shutdown off
  Wire.endTransmission();
 
 
  //device setup to accept charectures now, are we doing a display test?
 
  if(testMode == 1) {
   
    //test is wanted, this lightsup all segments for 1.5 seconds then turns off
    Wire.beginTransmission(_address);
    Wire.write(0x07);     //TestRegister
    Wire.write(0x01);     //Turn it on
    Wire.endTransmission();
   
    delay(1500); //delay 1.5 seconds
   
    Wire.beginTransmission(_address);
    Wire.write(0x07);     //TestRegister
    Wire.write(_off);     //Turn it off
    Wire.endTransmission();
  }
 
  else {
    Wire.beginTransmission(_address);
    Wire.write(0x07);     //TestRegister
    Wire.write(_off);     //Turn it off
    Wire.endTransmission();

   
  } //end test;
 
 
} //END BEGIN





/******************* High Level commands */

void Maxim6955::clear() {
  //manual function to clear display
  _d0 = 32; //space char
  _d1 = 32; //space char
  _d2 = 32; //space char
  _d3 = 32; //space char
  _d4 = 32; //space char
  _d5 = 32; //space char
  _d6 = 32; //space char
  _d7 = 32; //space char
 
  Wire.beginTransmission(_address);
  Wire.write(0x20);     //TestRegister
  Wire.write(_d0);       //"space" Char
  Wire.write(_d1);       //"space" Char
  Wire.write(_d2);       //"space" Char
  Wire.write(_d3);       //"space" Char
  Wire.write(_d4);       //"space" Char
  Wire.write(_d5);       //"space" Char
  Wire.write(_d6);       //"space" Char
  Wire.write(_d7);       //"space" Char
  Wire.endTransmission();
}


inline size_t Maxim6955::write(uint8_t value) {
  send(value);
  return 1; // assume sucesss
}


// Send to a string
void Maxim6955::send(uint8_t value) {
 _d0 = _d1;
 _d1 = _d2;
 _d2 = _d3;
 _d3 = _d4;
 _d4 = _d5;
 _d5 = _d6;
 _d6 = _d7;
 _d7 = value;
 
  //_holder = value;
 

  Wire.beginTransmission(_address);
 
 

  Wire.write(0x20);
  Wire.write(_d0);
  Wire.write(_d1);
  Wire.write(_d2);
  Wire.write(_d3);
  Wire.write(_d4);
  Wire.write(_d5);
  Wire.write(_d6);
  Wire.write(_d7);

  Wire.endTransmission();
}


now the sketch
Code:
//max6955.ino

#include <Wire.h>
#include <max6955.h>

Maxim6955 max1(0x60);
int x = 0;

void setup() {
  max1.begin(1);
}

void loop() {
  max1.clear();
  //delay(500);
  max1.print(x);
  x++;
  delay(1000);
  //Serial.println(x);
}

The same also happens if I do not use my libary and insted just send the I2C data by using the following

Code:
//////////////////////////////////////////////////////////////////
//  The inner workings of the golem...
//  brightness pin 2 on arduino
//  TMP36 on Pin A0
/////////////////////////////////////////////////////////////////
#include <Wire.h>;

int x = 0;       // count the loops to see if we get a hang

int mode = 0;    // Default mode theat the system boots up in

int testOff = 0; // for some reason will not let me reite 0x00 tot he system so define it here
int digit0 = 32; // "space char as default - blank digit on boot"
int digit1 = 32; // "space char as default - blank digit on boot"
int digit2 = 32; // "space char as default - blank digit on boot"
int digit3 = 32; // "space char as default - blank digit on boot"
int digit4 = 32; // "space char as default - blank digit on boot"
int digit5 = 32; // "space char as default - blank digit on boot"
int digit6 = 32; // "space char as default - blank digit on boot"
int digit7 = 32; // "space char as default - blank digit on boot"
byte numbers[10]; //array to hold the numbers in , not sure It i will need

int max1 = 0x60; //address of first max6955 chip

int brightness = 0x0D; //original brightness level
int tempPin = A0;

//////////////////////////////////////////////////////////////////
//       MAX6955 REGISTERS
//////////////////////////////////////////////////////////////////

int regDecode = 0x01;
int regIntens = 0x02;
int regScan   = 0x03;
int regConfig = 0x04;
int regTest   = 0x07;

//////////////////////////////////////////////////////////////////
//        END REGISTER SETUP
//////////////////////////////////////////////////////////////////

void setup() {
  pinMode(2, INPUT);
  //pinMode(tempPin, INPUT);
  Serial.begin(9600);
  Wire.begin(0x00);
  wireSetup();
  show(); //sends initial chars to the display
 
  //setup nuumbers
  numbers[0] = 48;
  numbers[1] = 49;
  numbers[2] = 50;
  numbers[3] = 51;
  numbers[4] = 52;
  numbers[5] = 53;
  numbers[6] = 54;
  numbers[7] = 55;
  numbers[8] = 56;
  numbers[9] = 57;
  numbers[0] = 48;
 
  Serial.println("End Setup"); //for debug, lets me know when its free.
}

void loop() {
   
/////////////// count demo////////////////////
  for(int x=0; x<10000; x++){
    if(x<10) {
      digit0 = numbers[0];
      digit1 = numbers[0];
      digit2 = numbers[0];
      digit3 = numbers[x];
    }
    else if(x<100) {
      digit0 = numbers[0];
      digit1 = numbers[0];
      digit2 = numbers[x / 10];
      digit3 = numbers[x % 10];
    }
    else if(x<1000) {
      digit0 = numbers[0];
      digit1 = numbers[x / 100];
      digit2 = numbers[(x % 100)/10];
      digit3 = numbers[x % 10];
    }
    else if(x<10000) {
      digit0 = numbers[x / 1000];
      digit1 = numbers[(x % 1000)/100];
      digit2 = numbers[(x % 100)/10];
      digit3 = numbers[x % 10];
    }
    show();
    delay(50);
  }

//////END COUNT DEMO ????????????????????
} //end loop

void show() {
  Wire.beginTransmission(max1);
  Wire.write(0x02);
  Wire.write(brightness);
  Wire.endTransmission();
  Wire.beginTransmission(max1);
  Wire.write(0x20);
  Wire.write(digit0);
  Wire.write(digit1);
  Wire.write(digit2);
  Wire.write(digit3);
  Wire.write(digit4);
  Wire.write(digit5);
  Wire.write(digit6);
  Wire.write(digit7);
  Wire.endTransmission();
   
  ////////////////////////
  //    serial debug    // 
  ////////////////////////
  Serial.print(char(digit0));
  Serial.print(char(digit1));
  Serial.print(char(digit2));
  Serial.print(char(digit3));
  Serial.print(char(digit4));
  Serial.print(char(digit5));
  Serial.print(char(digit6));
  Serial.println(char(digit7));
 
  /////////////////////////
  //  end serial debug   //
  /////////////////////////
}

void wireSetup() {
  Wire.beginTransmission(max1);
  Wire.write(regTest);
  Wire.write(0x01);
  Wire.endTransmission();
  delay(1500);
  Wire.beginTransmission(max1);
  Wire.write(regTest);
  Wire.write(testOff);
  Wire.endTransmission();
  Wire.beginTransmission(max1);
  Wire.write(regDecode);
  Wire.write(0b11111111); //decode all digits 1 is decode 0 gives direct access
  Wire.write(0x01);       //Intensity default, guess I should take this from a pin to see where the dash lights are at...
  Wire.write(0x07);       // hex easiest way of seeing which digits to scan (all 8 is 0x07)
  Wire.write(0x01);       // Control Reg 0x01 is shutdown off
  Wire.endTransmission();
}



Any help would be greatly apprechiated.

I have narrowed it down to the arduino, and the fact that it hangs / stops says to me its running out of ram, if I reset the arduino (withouth disturbing the power supply), it will start from the beggining, so it appears not to be the display chip.

Finally, if I enable the serial output, it stops sending serial data when it hangs also.

Many thanks

Jimmy
11  Using Arduino / Project Guidance / Re: Running out of Sram / program hang. on: April 22, 2012, 11:47:02 am
Many thanks for the reply, sorry for the delay in getting back to you, ive been busy trying to build a windows to I2C interface to see if it is the display chip thats the problem or the Arduino program.

It turnsout that on the PC, I can send i2c signals all day long with no problem, but with the arduino using my libary Ihave a problem a few times around the loop().

It is often around the 2460th time round.

I have written a simple sketch but not sure if I should put it in here or not.

Jimmy
12  Using Arduino / Project Guidance / Running out of Sram / program hang. on: April 10, 2012, 06:14:39 pm
If the program hangs for any reason, is it likey cto cause any damage to the chip?

I have a system that hands sometimes after around 2000 loops when using the I2C bus, but not writing to it and just using serial, is fine.

If I were to not notice it had hung (for instance coding something else) would it case a problem?

Also as a secondary question, id there a maximum number of times the Arduino can be written to? If so could this be causing it to hang?
13  Using Arduino / Project Guidance / Re: hack this display... on: April 09, 2012, 11:45:12 am
Once you have these you can drive the display as you want.

Not really - bare LCDs use an AC signal, not DC. If you apply DC (for longer than the brief instance you mention), you end up destroying the LCD (well, that segment). PWM'ing the signal won't be enough, either (as that only fluctuates between 0-5 volts DC); what you would need to do (minimum) would be to bias the signal in the negative direction by 2.5 volts to get it to fluctuate between -2.5 and 2.5 volts; depending on the display, this may or may not be enough to drive the segments (and thus an amplification stage would be needed).

Really, that is news to me, I has assured they were DC in the past. Everyday is a school day.
14  Using Arduino / Project Guidance / Re: hack this display... on: April 09, 2012, 09:50:39 am
Hi,

When I have been using simmular things in the past, to trace them out, I use a battery such as a 9V one and a resistor, but in this instance I would not reccomend using this approch, I would in this instance use a AAA battery so that you can be fine with the (logical) voltage levels.

Now in order to test the displays (I do this with 16 segment / 7 segment displays) I pic one of the "pins" as a ground and run the positive across the other pins and make note of the result.

If you get a segment flash, this is a good sign it means you have the ground right (most of the time).

If you get nothing, it could be one of two things, 1st is that you havent got the ground / power right (most common), or the didplay is fried, not often the case, deffinately if you do it quick.

Once you have these you can drive the display as you want.
15  Using Arduino / Programming Questions / Re: How to output data? on: April 09, 2012, 09:12:09 am
I thought it would send the full string that was printed, nence the loop to breack it down into the component characters of the string, which I could then go though, I am trying to make this build up a full string in the send() sections.

Or I could create a new function that will start the Wire transmission, and then the bit that outputs, then one that ends the transmission.

I prefer the idea of the first though.

Next thing to investigate is to see what how to build a string from the write() or the send().

Many thanks for the pointers so far.
Pages: [1] 2