Show Posts
Pages: 1 2 [3] 4
31  Using Arduino / Project Guidance / Re: Just getting started, need help picking parts (motor and servo possibly?) on: June 22, 2012, 07:56:35 pm
I have used steppers from a printer to do stuff. They are easy and cheap to get and work.
32  Using Arduino / Project Guidance / Re: LCD screen controlling servos on: June 22, 2012, 04:33:31 pm
Forgive me for a potentially stupid question. But what is the purpose of the RW bit if the screen cant be read?
33  Using Arduino / Project Guidance / Three way servo control on: June 22, 2012, 12:00:29 pm
Hi guys, I have a set of servos which I am controlling with pots at the moment. I would like to install a three way switch to allow me to choose between using the pots, serial input or have them even out the output from a set of four photoresistors. The project is a solar tracker, but I want to maintain manual control as well. Any thoughts on how I should go about this?
34  Using Arduino / Displays / Re: arduino newbie lcd variable on: October 26, 2011, 01:47:10 pm
It sounds like youre doing something very similar to what I was doing. I had to convert that float (double in my case) to a string that the LCD could understand first.

Did you already get it sorted out?
35  Using Arduino / Displays / Re: How do I display serial data to nokia 5110 lcd? on: October 25, 2011, 07:24:47 pm
Solved. Thanks to the guys on #arduino. This project is finally alive and I learned a lot doing it, thanks to a few who were willing to help me. Seeing as how this display is on back order and Sparkfun plans to stock it for as long as they can buy it, I have to assume this display is pretty popular. Being able to display the serial data that is both coming in and going out seems like something many people would want to do. I'm surprised that this thread generated no interest whatsoever.
36  Using Arduino / Displays / Re: How do I display serial data to nokia 5110 lcd? on: October 25, 2011, 11:49:36 am
Some of the kind and smart folks in #arduino helped me to see my problem here. I need to convert the double to a string, then I should be able to print that to the display. I have googled every single thing I've been told and tried to use the functions I've found with no avail. I am open to using any of th eavailable functions for this; sprintf, itoa or whatever else. The one I like that says explicitly that it will do what I'm asking is dtostrf(). I have tried every way I can think of to implement it in to my code and nothing works. Will someone please look at my code below and give me a clue as to what to do with it? The reason I'm putting the (Thermister(analogRead(0))) inside the ()'s is because that is what I use with Serial.print, and it works great for outputting to serial monitor. Below is my best attempt and it doesn't work, please help!

Code:

// Thermistor math to determine temperature

double Thermister(int RawADC) {
  double Temp;
  Temp = log(((10240000/RawADC) - 10000));
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;      // Convert Kelvin to Celcius
  Temp = Thermister(analogRead(0));
  dtostrf(Temp,5, 2, 7);
  return Temp;
  
}  
37  Using Arduino / Displays / How do I display serial data to nokia 5110 lcd? on: October 23, 2011, 09:43:20 pm
I have been able to use a thermistor with my arduino and read the serial output with a serial monitor. I have also been able to attach a nokia 5110 lcd using the wiring and example code found at the playground. What I want to do is display the serial output on the LCD, as you may have guessed. I dont understand the pin functions on this LCD and I dont understand what I need to do in order to display the serial data. All I have for code is the examples of code that have already worked, one for the thermistor and one for the LCD. I've only pasted them together and am trying to figure out how to get it to do what I want. I really have no clue here and desperately need someone to help me understand this. I would appreciate any help, thanks!

Here is the code I have. I know that much of it is unneeded. As I said its just two pieces that didnt go together but I'm trying to make them go together. The Serial.print in the loop at the end does not work btw. This code only gives me a square box on the screen.

Code:
/*
Thermistor output to LCD
*/

#include <math.h>
 
// Arduino to LCD pin configuration
#define PIN_SCE   7 //To LCD Pin 3
#define PIN_RESET 6 //To LCD Pin 4
#define PIN_DC    5 //To LCD Pin 5
#define PIN_SDIN  4 //To LCD Pin 6
#define PIN_SCLK  3 //To LCD Pin 7
 
// Configuration for the LCD
#define LCD_C     LOW
#define LCD_D     HIGH
#define LCD_CMD   0
 
// Size of the LCD
#define LCD_X     84
#define LCD_Y     48
 
/*
int scrollPosition = -10;
 
static const byte ASCII[][5] =
{
 {0x00, 0x00, 0x00, 0x00, 0x00} // 20
,{0x00, 0x00, 0x5f, 0x00, 0x00} // 21 !
,{0x00, 0x07, 0x00, 0x07, 0x00} // 22 "
,{0x14, 0x7f, 0x14, 0x7f, 0x14} // 23 #
,{0x24, 0x2a, 0x7f, 0x2a, 0x12} // 24 $
,{0x23, 0x13, 0x08, 0x64, 0x62} // 25 %
,{0x36, 0x49, 0x55, 0x22, 0x50} // 26 &
,{0x00, 0x05, 0x03, 0x00, 0x00} // 27 '
,{0x00, 0x1c, 0x22, 0x41, 0x00} // 28 (
,{0x00, 0x41, 0x22, 0x1c, 0x00} // 29 )
,{0x14, 0x08, 0x3e, 0x08, 0x14} // 2a *
,{0x08, 0x08, 0x3e, 0x08, 0x08} // 2b +
,{0x00, 0x50, 0x30, 0x00, 0x00} // 2c ,
,{0x08, 0x08, 0x08, 0x08, 0x08} // 2d -
,{0x00, 0x60, 0x60, 0x00, 0x00} // 2e .
,{0x20, 0x10, 0x08, 0x04, 0x02} // 2f /
,{0x3e, 0x51, 0x49, 0x45, 0x3e} // 30 0
,{0x00, 0x42, 0x7f, 0x40, 0x00} // 31 1
,{0x42, 0x61, 0x51, 0x49, 0x46} // 32 2
,{0x21, 0x41, 0x45, 0x4b, 0x31} // 33 3
,{0x18, 0x14, 0x12, 0x7f, 0x10} // 34 4
,{0x27, 0x45, 0x45, 0x45, 0x39} // 35 5
,{0x3c, 0x4a, 0x49, 0x49, 0x30} // 36 6
,{0x01, 0x71, 0x09, 0x05, 0x03} // 37 7
,{0x36, 0x49, 0x49, 0x49, 0x36} // 38 8
,{0x06, 0x49, 0x49, 0x29, 0x1e} // 39 9
,{0x00, 0x36, 0x36, 0x00, 0x00} // 3a :
,{0x00, 0x56, 0x36, 0x00, 0x00} // 3b ;
,{0x08, 0x14, 0x22, 0x41, 0x00} // 3c <
,{0x14, 0x14, 0x14, 0x14, 0x14} // 3d =
,{0x00, 0x41, 0x22, 0x14, 0x08} // 3e >
,{0x02, 0x01, 0x51, 0x09, 0x06} // 3f ?
,{0x32, 0x49, 0x79, 0x41, 0x3e} // 40 @
,{0x7e, 0x11, 0x11, 0x11, 0x7e} // 41 A
,{0x7f, 0x49, 0x49, 0x49, 0x36} // 42 B
,{0x3e, 0x41, 0x41, 0x41, 0x22} // 43 C
,{0x7f, 0x41, 0x41, 0x22, 0x1c} // 44 D
,{0x7f, 0x49, 0x49, 0x49, 0x41} // 45 E
,{0x7f, 0x09, 0x09, 0x09, 0x01} // 46 F
,{0x3e, 0x41, 0x49, 0x49, 0x7a} // 47 G
,{0x7f, 0x08, 0x08, 0x08, 0x7f} // 48 H
,{0x00, 0x41, 0x7f, 0x41, 0x00} // 49 I
,{0x20, 0x40, 0x41, 0x3f, 0x01} // 4a J
,{0x7f, 0x08, 0x14, 0x22, 0x41} // 4b K
,{0x7f, 0x40, 0x40, 0x40, 0x40} // 4c L
,{0x7f, 0x02, 0x0c, 0x02, 0x7f} // 4d M
,{0x7f, 0x04, 0x08, 0x10, 0x7f} // 4e N
,{0x3e, 0x41, 0x41, 0x41, 0x3e} // 4f O
,{0x7f, 0x09, 0x09, 0x09, 0x06} // 50 P
,{0x3e, 0x41, 0x51, 0x21, 0x5e} // 51 Q
,{0x7f, 0x09, 0x19, 0x29, 0x46} // 52 R
,{0x46, 0x49, 0x49, 0x49, 0x31} // 53 S
,{0x01, 0x01, 0x7f, 0x01, 0x01} // 54 T
,{0x3f, 0x40, 0x40, 0x40, 0x3f} // 55 U
,{0x1f, 0x20, 0x40, 0x20, 0x1f} // 56 V
,{0x3f, 0x40, 0x38, 0x40, 0x3f} // 57 W
,{0x63, 0x14, 0x08, 0x14, 0x63} // 58 X
,{0x07, 0x08, 0x70, 0x08, 0x07} // 59 Y
,{0x61, 0x51, 0x49, 0x45, 0x43} // 5a Z
,{0x00, 0x7f, 0x41, 0x41, 0x00} // 5b [
,{0x02, 0x04, 0x08, 0x10, 0x20} // 5c ¥
,{0x00, 0x41, 0x41, 0x7f, 0x00} // 5d ]
,{0x04, 0x02, 0x01, 0x02, 0x04} // 5e ^
,{0x40, 0x40, 0x40, 0x40, 0x40} // 5f _
,{0x00, 0x01, 0x02, 0x04, 0x00} // 60 `
,{0x20, 0x54, 0x54, 0x54, 0x78} // 61 a
,{0x7f, 0x48, 0x44, 0x44, 0x38} // 62 b
,{0x38, 0x44, 0x44, 0x44, 0x20} // 63 c
,{0x38, 0x44, 0x44, 0x48, 0x7f} // 64 d
,{0x38, 0x54, 0x54, 0x54, 0x18} // 65 e
,{0x08, 0x7e, 0x09, 0x01, 0x02} // 66 f
,{0x0c, 0x52, 0x52, 0x52, 0x3e} // 67 g
,{0x7f, 0x08, 0x04, 0x04, 0x78} // 68 h
,{0x00, 0x44, 0x7d, 0x40, 0x00} // 69 i
,{0x20, 0x40, 0x44, 0x3d, 0x00} // 6a j
,{0x7f, 0x10, 0x28, 0x44, 0x00} // 6b k
,{0x00, 0x41, 0x7f, 0x40, 0x00} // 6c l
,{0x7c, 0x04, 0x18, 0x04, 0x78} // 6d m
,{0x7c, 0x08, 0x04, 0x04, 0x78} // 6e n
,{0x38, 0x44, 0x44, 0x44, 0x38} // 6f o
,{0x7c, 0x14, 0x14, 0x14, 0x08} // 70 p
,{0x08, 0x14, 0x14, 0x18, 0x7c} // 71 q
,{0x7c, 0x08, 0x04, 0x04, 0x08} // 72 r
,{0x48, 0x54, 0x54, 0x54, 0x20} // 73 s
,{0x04, 0x3f, 0x44, 0x40, 0x20} // 74 t
,{0x3c, 0x40, 0x40, 0x20, 0x7c} // 75 u
,{0x1c, 0x20, 0x40, 0x20, 0x1c} // 76 v
,{0x3c, 0x40, 0x30, 0x40, 0x3c} // 77 w
,{0x44, 0x28, 0x10, 0x28, 0x44} // 78 x
,{0x0c, 0x50, 0x50, 0x50, 0x3c} // 79 y
,{0x44, 0x64, 0x54, 0x4c, 0x44} // 7a z
,{0x00, 0x08, 0x36, 0x41, 0x00} // 7b {
,{0x00, 0x00, 0x7f, 0x00, 0x00} // 7c |
,{0x00, 0x41, 0x36, 0x08, 0x00} // 7d }
,{0x10, 0x08, 0x08, 0x10, 0x08} // 7e ←
,{0x00, 0x06, 0x09, 0x09, 0x06} // 7f →
};
*/

void LcdCharacter(char character)
{
  LcdWrite(LCD_D, 0x00);
  for (int index = 0; index < 5; index++)
  {
    LcdWrite(LCD_D, ASCII[character - 0x20][index]);
  }
  LcdWrite(LCD_D, 0x00);
}


void LcdClear(void)
{
  for (int index = 0; index < LCD_X * LCD_Y / 8; index++)
  {
    LcdWrite(LCD_D, 0x00);
  }
}
 
void LcdInitialise(void)
{
  pinMode(PIN_SCE,   OUTPUT);
  pinMode(PIN_RESET, OUTPUT);
  pinMode(PIN_DC,    OUTPUT);
  pinMode(PIN_SDIN,  OUTPUT);
  pinMode(PIN_SCLK,  OUTPUT);
 
  digitalWrite(PIN_RESET, LOW);
  digitalWrite(PIN_RESET, HIGH);
 
  LcdWrite(LCD_CMD, 0x21);  // LCD Extended Commands.
  LcdWrite(LCD_CMD, 0xBf);  // Set LCD Vop (Contrast). //B1
  LcdWrite(LCD_CMD, 0x04);  // Set Temp coefficent. //0x04
  LcdWrite(LCD_CMD, 0x14);  // LCD bias mode 1:48. //0x13
  LcdWrite(LCD_CMD, 0x0C);  // LCD in normal mode. 0x0d for inverse
  LcdWrite(LCD_C, 0x20);
  LcdWrite(LCD_C, 0x0C);
}
 
void LcdString(char *characters)
{
  while (*characters)
  {
    LcdCharacter(*characters++);
  }
}
 
void LcdWrite(byte dc, byte data)
{
  digitalWrite(PIN_DC, dc);
  digitalWrite(PIN_SCE, LOW);
  shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
  digitalWrite(PIN_SCE, HIGH);
}
 
/**
 * gotoXY routine to position cursor
 * x - range: 0 to 84
 * y - range: 0 to 5
 */
void gotoXY(int x, int y)
{
  LcdWrite( 0, 0x80 | x);  // Column.
  LcdWrite( 0, 0x40 | y);  // Row.
}
 
void drawBox(void)
{
  int j;
  for(j = 0; j < 84; j++) // top
  {
    gotoXY(j, 0);
    LcdWrite(1, 0x01);
  }   
 
  for(j = 0; j < 84; j++) //Bottom
  {
    gotoXY(j, 5);
    LcdWrite(1, 0x80);
  }   
 
  for(j = 0; j < 6; j++) // Right
  {
    gotoXY(83, j);
    LcdWrite(1, 0xff);
  }   
 
  for(j = 0; j < 6; j++) // Left
  {
    gotoXY(0, j);
    LcdWrite(1, 0xff);
  }
}
 
void Scroll(String message)
{
  for (int i = scrollPosition; i < scrollPosition + 11; i++)
  {
    if ((i >= message.length()) || (i < 0))
    {
      LcdCharacter(' ');
    }
    else
    {
      LcdCharacter(message.charAt(i));
    }
  }
  scrollPosition++;
  if ((scrollPosition >= message.length()) && (scrollPosition > 0))
  {
    scrollPosition = -10;
  }
}
 
void setup(void)
{
  Serial.begin(9600);
 
  LcdInitialise();
  LcdClear();
  drawBox();
   
}

// Thermistor code

double Thermister(int RawADC) {
  double Temp;
  Temp = log(((10240000/RawADC) - 10000));
  Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
  Temp = Temp - 273.15;           // Convert Kelvin to Celcius
  return Temp;


void loop(void)
{
  gotoXY(4,4);
  Serial.print(Thermister(analogRead(0)));
  Serial.print(176, BYTE);
  Serial.println("C");
  delay(1000);
}

The display is wired according to the comments in the beginning of the code. Below is a pinout fot the display and a link to the datasheet, which I struggle to understand.

Datasheet




PS; I had a much better post written that took me a long time to write then something happened and poof, it was gone. I really do appreciate any help, thanks!

38  Using Arduino / General Electronics / Re: First serious project-Device to check melting points on: May 12, 2011, 10:17:54 am
Thanks guys! Time to get this ball rolling. I will keep this thread updated! At work now, so I can't say much besides thanks!
39  Using Arduino / General Electronics / First serious project-Device to check melting points on: May 11, 2011, 10:35:33 pm
I know what needs to happen, I'm just not sure how to make it happen. I'm going back to school for chemistry because I love it and even at my age I think you should pursue the things you love. Anyway, I'm building a device to check melting points. I have a surplus heater from a coffee pot I got from American Science Surplus that runs straight 120v and draws 8a, supposedly this little thing will get very very hot. It's shaped like a cup, or a shot glass, more accurately. I have a small lathe and will be making a stainless steel plug that goes in the 'cup'. On top of that stainless steel insert I will have a very small ~6mm radius in the center highly polished that will hold the specimen being checked. For components, I have a thermistor on it's way from sparkfun (10k), my arduino uno and most of my basic odds and ends. Switching of the element will be done with a solid state relay. I also have a nokia 5110 lcd I would like to use for visual feedback of temperature and other settings, if there be any. In a perfect world I'd want to interface the arduino with my computer and write a small piece of software that starts the element heating and upon my pressing of say, the space bar, it stops heating and records that temperature. In a realistic world, however, a start/stop button attached to the arduino is fine. Perhaps even incorporate a potentiometer to either limit top end temperature, adjust the speed at which the temperate rises, or both. Again, that is secondary.

My question (the first of many) is what do I need to learn in order to make the arduino begin pwm-ing the relay when i hit go, stop when I hit go again and have the current temperature displayed in real time on the lcd? All the other functionality can be added later. I'm really motivated to build this and that's the best way for me to learn. I'm beggin' here, help me!

I'm not afraid to read, I just don't know what to read lol. Also, any advice from experience with thermistors and reading accurate temperatures from them would be awesome.

Thanks a million, guys!
40  Using Arduino / General Electronics / Re: LCD Pinout on: May 09, 2011, 03:57:29 pm
HAHA, OP, I had a dozen of those one time. Surplus galore on those things. I never got the chance to use one, long story :^(
41  Using Arduino / General Electronics / Re: How can I communicate wirelessly without IR? on: May 08, 2011, 05:32:59 pm
Nice link, CrossRoads!

I didn't mean to imply that ir and rf were functionally the same. I only went off on a tangent because this thread got me thinking about all the invisible light around us.

:headexplodes:
42  Using Arduino / General Electronics / Re: How can I communicate wirelessly without IR? on: May 08, 2011, 12:32:46 am
In many ways the two are the same, though. They are both forms of electromagnetic radiation, just at different wavelengths. They are both digital signals, ie ons and offs. The rf is just more of a moving target since it's carrier frequency can vary. Its a trip to think about how all of our devices, our phones and wifi equipped laptops and all that stuff is spewing out this radiation all the time and its exactly like the light we see, just at a different wavelength. I often imagine how bright a cell phone tower must look if I could see that wavelength of 'light'.

My head just exploded. I should probably clean up this mess.

Oh, nevermind, one kleenex got it.
43  Using Arduino / General Electronics / Re: Newbie question: how to build a valid circuit on: May 05, 2011, 07:55:18 am
The word 'tree' is protected under copyright laws. If you could use term 'non-animal life form' that would be great.
44  Using Arduino / General Electronics / Re: Newbie question: how to build a valid circuit on: May 04, 2011, 08:23:07 pm
I buy when I like. I'm a book lover. PDFs don't do it for me.
45  Using Arduino / General Electronics / Re: Newbie question: how to build a valid circuit on: May 04, 2011, 07:44:43 pm
Is that a legitimate free ebook, or a pirate?

I really can't condone pirated IP.
I guess admin answered that. I treat books much the way I treat music. I download via torrent and if I find that I like the entire cd, or book, I'll buy it (I think my bank statements would prove that). There is no replacement for a hard copy in your hands book, just like there is no replacement for an actual pressed cd. I guess if I were at one of you guy's house and tried to read through your copy that would be illegal too. I call it sharing, I don't really care what other people call it. A crappy scanned pdf is not just as good as a book book, it's a way to try before you buy and know that this book is either for you or not. It saved me from buying a copy of the getting started with arduino book. Once I scanned through the pdf I knew right away that I didn't want it.

I'll just have to remember this site is super anal about such things.
Pages: 1 2 [3] 4