Show Posts
Pages: [1]
1  Using Arduino / Installation & Troubleshooting / Re: upload sketch through serial over tcp/ip (ser2net or socat) on: April 19, 2014, 12:15:23 am
I like the idea of using ser2net on the remote node the arduino is connected to, and socat or something else on another machine.,

If you are able to use teamviewer, that means you are being lazy and don't want to walk across the room, or down the hall where the arduino is.

The point this post was made to able simple,effective communications over a network using hardware that may not support something with  a screen.

teamviewer is a great tool for remote fixing someone's computer, and maybe some other things, but decompresses the real use of arduino as a remote uController.

I have been using an HP thin client with 800MHz VIA Processor, 128MB RAM with maybe 128MB Flash, if not 64 to run tinycoreOS with ser2net. That methods works fantastic. This young man showed me something I should have done, and that was just make another network port with USB speeds faster for the IDE uses to program the arduino.

If I can get socat to work on my machines to avoid extra steps to program, then that would be great. If not, then I'll build alias cmd to do all that with on keyword. Then my arduino and network node will be dispatched in the coming days to start living the outdoor life. That will be one more project down.

excellent work my forward right thinking man! I am ecstatic about your work!
2  Using Arduino / General Electronics / Power Supplies on: February 13, 2013, 10:28:27 pm
I've taken note that some power supplies are better for use with Ardunio, than others.

What has been evident to me, is that if you are going to use a voltage converting power supply, just to power the arduino, you need to make sure the power supply can handle it.

What I mean by this, is that you need to make sure the voltage converting power supply has the bare minimum load on it, otherwise it will behave erratically, and cause errors in various types of ways.

All converting power supplies, either switchmode or linear, must have a minimum load on them, which is usually 10% of their rated current. There are some technical reasons for it, but I don't remember them. Something to do with having a load ensures proper voltage regulation and voltage output stability.

As an example, I was powering my arduino project with a 9V 1.5A switchmode power supply from an old portable DVD player. The arduino, current sensor, and LCD were drawing about 75mA. No where near what I should have been putting on the power supply. In this case, it should have been at least 150mA. Sure I could have powered a light or something, but I elected to run the project from the battery that I monitoring the voltage and current statistic from. The LCD screen no longer flickers, measurements are considerably more stable, and also there's proper grounding.

Switchmode power supplies are also inherently noisy, especially the cheap Chinese/Taiwanese ones.  The switchmode carrier frequency can range from lower tens of KHz up to single digit MHz. The cheap ones also have poor noise filtering, poor RF shielding, and use cheap parts which will eventually fail sooner than later.

Linear power supplies must be loaded down with the minimum load as well, but they do not generate the RF hash like the crappy SMPS do. However, some of the linear power supplies have little or no output filtering, so you will hear the utility line frequency hum if the power supply is connected to any type of audio device. I my case, its a mobile amateur radio.

You may be able to do some software coding to filter the noise out, but this is case I'd recommend using hardware instead of software for filtering. Less to go wrong, works more reliably, and less code to be run on your arduino.
3  Using Arduino / Displays / Re: Nokia 3310 / 5510 LCD assistance without library on: February 06, 2013, 02:54:31 pm
well. It looks like I found two of the things I was looking for.

First, the lines of code that I wanted to do their thing, and display the resulting information on the screen.

In the 'void setup()' I had 'lcd.begin(12,6)'. Apparently to the PCD8544.cpp file, I saw this particular line wasn't correct for this particular application. In the 'PCD8544 begin' section, the initial setup, there was was no need to describe the amount of columns or lines/rows. So I removed the 12,6 and now just have 'lcd.begin()'.

Then in the code that pertains to the particular set of information that  needed to be displayed on a certain LCD line, I used the 'lcd.setCursor(x,x)'.

From the original bits of code I but together the delay was 10ms. That was too fast and the voltage and other stuff really changed too fast, so I set that to 1500ms.

to change the contrast, I thought from the non-library code that I originally posted, I could add the line 'this->send(PCD8544_CMD 0xB5)' under the 'begin' parameters. That didn't an apparent thing. I ended up changing a few hex codes to eventually end up where the bias is what changed the LCD contrast. That line was 'this->send(PCD8544_CMD 0x15)'.

And so it also seems to me, this crap is using hex to communicate with the screen and '0xba' is for a different command that '0xBa'.

Thanks for the assistance. I've learned a little about C and C++ from the mess. I understand how it works, for me it's just a matter of knowing syntax, and all the sub-processes/commands involved to do ONE thing. And that ONE thing could be one of many things to do another ONE process.
4  Using Arduino / Displays / Re: Nokia 3310 / 5510 LCD assistance without library on: February 06, 2013, 09:01:03 am

I did get the code to compile successfully this time. I've had it compile fine without the library before, but the 'LCDString' and my knowledge of the that sector only allowed a static display on the LCD. I could adjust the contrast all that jazz, but could not get the code to update the display.

This library does display changing data on the display, however, it's very light contrast, and only displaying the last line of instructions:
  lcd.print(" Ah ");
  lcd.print(" Wh ");

There are two sets of other instructions right above this line, that are not being shown on the LCD:
    lcd.print(" V ");
    lcd.print(" A ");
  lcd.print(" W ");
  lcd.print(" H ");

I'm looking in the header and .cpp file to see if I can adjust the contract either direct, or by command in the 'sketch' code.
5  Using Arduino / Displays / Re: Nokia 3310 / 5510 LCD assistance without library on: February 05, 2013, 11:07:29 pm
ok, I tried the libraries, both from Adafruit, and PCD8544.h. Errors, errors, more errors. Shit having to do with abstract, not being able to define something that is in the top of the damn code. What the hell is going on here?

This shit is really pissing me off. What in the hell am I doing wrong here?

Someone please point this dumb ass in the right direction about how to use a damn display
6  Using Arduino / Displays / Re: Nokia 3310 / 5510 LCD assistance without library on: February 05, 2013, 09:25:07 pm
If you did not change the definition of LCDString(), then this procedure accepts exactly one argument, but you have passed two: [LCDString(buff,"V");], namely [buff] and ["V"], which causes he error.

That much I figured as much. But, having zero idea what to change it to, or where can I find different options? Options such as changing the LCDString definition to something else entirely, to enable 'printing' of float data, or modifying it to print changing float data.
7  Using Arduino / Displays / Re: Nokia 3310 / 5510 LCD assistance without library on: February 04, 2013, 09:46:34 pm
So I tried this in void loop, and still no dice. Perhaps some of this is in the wrong place? Wrong Syntax?
char buf[8];
trying to compile this mess gives the following error:
"In function voidloop() error; too many arguments is 'void LCDString(char*) at this point in file. I have not made any modifications to that section of the code since I first posted this thread.

Do I need something in the 'void setup()' that converts float to char, or string or whatever the hell this is?

I tried removing the LCDString mess from the 'void loop()' and it supposedly compiles and uploads, but nothing on the LCD screen is shown
8  Using Arduino / Displays / Re: Nokia 3310 / 5510 LCD assistance without library on: February 04, 2013, 09:35:50 pm
I would love to use the libraries...

if they worked. I'm not understanding how for an LCD screen so common, with LOTS of different libraries for it, I cannot find one that will work.

However, I would like to gain an understanding to how make an LCD screen work without the use of a library so I can make use of the other LCD screens I have that do not have publicly available libraries for, like a couple of these larger Optrex 30x4 screens I have.

And going about this project this way, I don't have to stick with one LCD screen, I can change screens without changing many lines of code.
9  Using Arduino / Displays / Re: Nokia 3310 / 5510 LCD assistance without library on: February 04, 2013, 06:43:58 pm
I'm using the 1.0.3 Arduino IDE. The error that is being generated when I try to use:
void LCDString(char *characters);
"In function 'void loop()', error: too many arguments to function 'void LCDString(char*)'

I honestly have zero idea what any of the syntax for the LCDString means.

And, the code given, where does it go? I tried a few different ways, and either I get errors, or nothing is displayed on the on the LCD. Yes I checked the connections. I reverted back to the original code to make sure I didn't break anything.
10  Using Arduino / Displays / Nokia 3310 / 5510 LCD assistance without library on: February 04, 2013, 04:45:50 pm

I'm trying to figure out how to get the LCD display the Arduino calculated variables without using the PCD8544.h libraries. I've tried to use different ones from different sites, saved under different names  so I know which one I'm using, but none of them seem to work. So, I found some code that will make LCD display in bitmap, which is fine for what I want to use it for.

It works until I try to make the LCD display a variable using such code as:

LCDString("%i V\n",batteryVoltage);

The compiler generates output errors stating it does not like this code:
void LCDString(char *characters)
   while (*characters);

here is the full code. It is pieced together from other code.

#define PIN_SCE   7 //Pin 3 on LCD
#define PIN_RESET 6 //Pin 4 on LCD
#define PIN_DC    5 //Pin 5 on LCD
#define PIN_SDIN  4 //Pin 6 on LCD
#define PIN_SCLK  3 //Pin 7 on LCD
#define LCD_COMMAND 0
#define LCD_DATA  1
#define LCD_X     84
#define LCD_Y     48

int batMonPin = A4;   
int batVal = 0;       // variable for the A/D value
float pinVoltage = 0; // variable to hold the calculated voltage
float batteryVoltage = 0;
float ratio = 2.4;  // Change this to match the MEASURED ration of the circuit, 12k R1 and 5k R2
int analogInPin = A0;  // Analog input pin that the carrier board OUT is connected to
int sensorValue = 0;        // value read from the carrier board
int outputValue = 0;        // output in milliamps
unsigned long msec = 0;
float time = 0.0;
int sample = 0;
float totalCharge = 0.0;
float averageAmps = 0.0;
float ampSeconds = 0.0;
float ampHours = 0.0;
float wattHours = 0.0;
float amps = 0.0;

//This table contains the hex values that represent pixels
//for a font that is 5 pixels wide and 8 pixels high
static const byte ASCII[][5] = {
  *** code snipped***

 void setup()

void gotoXY(int x, int y)
  LCDWrite(0, 0x80 | x);  // Column.
  LCDWrite(0, 0x40 | y);  // Row.  ?

void LCDBitmap(char my_array[])
  for (int index = 0 ; index < (LCD_X * LCD_Y / 8) ; index++)
   LCDWrite(LCD_DATA, my_array[index]);


void LCDCharacter(char character)
  LCDWrite(LCD_DATA, 0x00); //Blank vertical line padding

  for (int index = 0 ; index < 5 ; index++)
    LCDWrite(LCD_DATA, ASCII[character - 0x20][index]);

  LCDWrite(LCD_DATA, 0x00); //Blank vertical line padding

//Given a string of characters, one by one is passed to the LCD
void LCDString(char *characters)
  while (*characters)

//Clears the LCD by writing zeros to the entire screen
void LCDClear(void)
  for (int index = 0 ; index < (LCD_X * LCD_Y / 8) ; index++)
    LCDWrite(LCD_DATA, 0x00);
  gotoXY(0, 0); //After we clear the display, return to the home position

//This sends the magical commands to the PCD8544
void LCDInit(void)

  //Configure control pins
  pinMode(PIN_SCE, OUTPUT);
  pinMode(PIN_DC, OUTPUT);
  pinMode(PIN_SDIN, OUTPUT);
  pinMode(PIN_SCLK, OUTPUT);

  //Reset the LCD to a known state
  digitalWrite(PIN_RESET, LOW);
  digitalWrite(PIN_RESET, HIGH);

  LCDWrite(LCD_COMMAND, 0x21); //Tell LCD that extended commands follow
  LCDWrite(LCD_COMMAND, 0xB9); //Set LCD Vop (Contrast): Try 0xB1(good @ 3.3V) or 0xBF if your display is too dark
  LCDWrite(LCD_COMMAND, 0x04); //Set Temp coefficent
  LCDWrite(LCD_COMMAND, 0x14); //LCD bias mode 1:48: Try 0x13 or 0x14

  LCDWrite(LCD_COMMAND, 0x20); //We must send 0x20 before modifying the display control mode
  LCDWrite(LCD_COMMAND, 0x0C); //Set display control, normal mode. 0x0D for inverse

//There are two memory banks in the LCD, data/RAM and commands. This
//function sets the DC pin high or low depending, and then sends
//the data byte
void LCDWrite(byte data_or_command, byte data)
  digitalWrite(PIN_DC, data_or_command); //Tell the LCD that we are writing either to data or a command

  //Send the data
  digitalWrite(PIN_SCE, LOW);
  shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
  digitalWrite(PIN_SCE, HIGH);

void loop()
    // read the analog in value:
  sensorValue = analogRead(analogInPin);           
  // convert to milli amps
  outputValue = (((long)sensorValue * 5000 / 1024) - 500 ) * 1000 / 133; 
/* sensor outputs about 100 at rest.
Analog read produces a value of 0-1023, equating to 0v to 5v.
"((long)sensorValue * 5000 / 1024)" is the voltage on the sensor's output in millivolts.
There's a 500mv offset to subtract.
The unit produces 133mv per amp of current, so
divide by 0.133 to convert mv to ma
  batVal = analogRead(batMonPin);    // read the voltage on the divider
  pinVoltage = batVal * 0.00488;       //  Calculate the voltage on the A/D pin
                                    //  A reading of 1 for the A/D = 0.0048mV
                                    //  if we multiply the A/D reading by 0.00488 then
                                    //  we get the voltage on the pin. 

  batteryVoltage = pinVoltage * ratio;    //  Use the ratio calculated for the voltage divider
                                          //  to calculate the battery voltage
  amps = (float) outputValue / 1000;
  float watts = amps * batteryVoltage;
  Serial.print("Volts = " );                       
  Serial.print("\t Current (amps) = ");     
  Serial.print("\t Power (Watts) = ");   
  sample = sample + 1;
  msec = millis();
 time = (float) msec / 1000.0;
 totalCharge = totalCharge + amps;
 averageAmps = totalCharge / sample;
 ampSeconds = averageAmps*time;

 ampHours = ampSeconds/3600;
 wattHours = batteryVoltage * ampHours;

  Serial.print("\t Time (hours) = ");
  Serial.print("\t Amp Hours (ah) = ");
  Serial.print("\t Watt Hours (wh) = ");
  // LCD readout 
  // LCDClear();
  LCDString("12.13V 3.48A");  // should be displaying batteryVoltage and amps
  LCDString("42.2W 0.5H");  // should be batteryVoltage*amps and time
  LCDString("21.1WH 1.74AH");  //should be displaying wattHours and ampHours

Pages: [1]