Show Posts
Pages: [1] 2
1  Using Arduino / Interfacing w/ Software on the Computer / Sending a value over serial, having issues. on: February 12, 2014, 09:48:27 pm
I've borrowed some code from this RGB Mixer http://lab.guilhermemartins.net/2010/07/22/processing-to-arduino/ and modified the arduino side to put the RGB (in my case just R and B) values into variables before sending them to the analog pins because I will also need the values for something else later on, it still works fine with the processing app (for the red and blue slider). I outputted the serial commands to the processing terminal to see what it was sending and it's as simple as RXXXBXXXGXXX, the X's being the value of the slider (0-255)

so I would think that if I don't use the processing app and just open an arduino terminal I should be able to type in my values manually like R255B255, it would set the LED to those values but it has no effect on the LED. It still works fine when I run the processing app, even though I've removed the G from my arduino code, which is what I want.

the reason I'm doing this is because the other half of the project is being written in VB and we will send values to the serial port in the same manner that processing does but I'm just testing it manually right now and it's not working at all.

here is my arduino code for you to see. My question is why isn't it taking the values that I manually put into the arduino serial monitor?

Code:
int SerialVal1;
int SerialVal2;
void setup()
{
  // declare the serial comm at 9600 baud rate
  Serial.begin(9600);

  // output pins
  pinMode(9, OUTPUT); // red
  pinMode(10, OUTPUT); // blue

}

void loop()
{
  // call the returned value from GetFromSerial() function
  switch(GetFromSerial())
  {
  case 'R':
    SerialVal1 = (GetFromSerial());
    break;
  case 'B':
    SerialVal2 = (GetFromSerial());
    break;

  }
  
    analogWrite(9, SerialVal1);
    analogWrite(10, SerialVal2);

}

// read the serial port
int GetFromSerial()
{
  while (Serial.available()<=0) {
  }
  return Serial.read();
}
2  Using Arduino / LEDs and Multiplexing / Re: RGB LED over RF using virtualwire? on: February 02, 2014, 10:36:07 am
 I believe I found something that I can work off of. At least I understand how it works now.
3  Using Arduino / LEDs and Multiplexing / RGB LED over RF using virtualwire? on: February 02, 2014, 09:51:51 am
I'm just looking for some example code and I can't seem to find any. All I want to do is send 3 variables from 3 pot readings from the transmitter to the receiver over RF using virtualwire that will change the PWM value of 3 outputs on the receiver end to change a RGB LED thats connected.

At most I can only find ON/OFF examples. Has anyone done this?

not looking for anyone to write the code for me, just push me in the right direction. Thanks.
4  Using Arduino / Programming Questions / Re: Blink without delay with independent on/off times? on: December 07, 2013, 01:46:55 pm
So this is off your page? well thanks for the help anyways smiley
Yeah, the code posted has a typo in it, so I recognized it...

yah, I noticed it too when I tried to run it.
5  Using Arduino / Programming Questions / Re: Blink without delay with independent on/off times? on: December 07, 2013, 01:16:07 pm
Code:
void loop() {
   digitalWrite(13, HIGH);   // set the LED on
   for (int x=0; x < 1000; x++) {     // Wait for 1 second
      delay(1);
   }
   digitalWrite(13, LOW);   // set the LED on
   for (int x=0; x < 1000; x++) {     // Wait for 1 second
      delay(1);
   }
}
Hey I recognize that code.... (http://www.baldengineer.com/blog/2011/01/06/millis-tutorial/) Example #2?  Not exaclty how I intended for it to be used.

Go to example #4.  Add an "if-statement" to determine if the LED is currently on or off.  Then increment the waitUntil based differnently for the on and off times.

Code:
unsigned long onTime = 1000;
unsigned long offTime = 500;
unsigned long waitUntil=0;
unsigned long interval = onTime;
boolean LED13state = true;

void setup() {
  pinMode(13, OUTPUT);
}
void loop() {
  // Each time through loop(), set Pin 13 to the same value as the state variable
  digitalWrite(13, LED13state);
  // Nothing will change until millis() increments by 1000

  if ((unsigned long)(millis() - waitUntil) >= interval) {
    if (LED13state) {
      // LED is currently on
      interval = offTime;
    }  else {
      // LED is currently off
      interval = onTime;
    }
    LED13state = !(LED13state);        // Toggle the LED's state
    waitUntil += interval;  
  }
}

ha!, yah I just happened to find it right after I posted this, but it didn't work the way I needed. So this is off your page? well thanks for the help anyways smiley
6  Using Arduino / Programming Questions / Re: Blink without delay with independent on/off times? on: December 07, 2013, 01:14:26 pm
Using a 1 milliSecond delay 1000 times is no better than using a 1000 millisecond delay once.

How about
Code:
unsigned long timeLedChanged = millis();
unsigned long period = 1000;
boolean ledOn = true;
const byte ledPin = 13;

void setup()
{
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  if (millis() - timeLedChanged >= period)
  {
    ledOn = !ledOn;
    timeLedChanged = millis();
    digitalWrite(ledPin, ledOn);  
    if (ledOn)
    {
      period = 1000;
    }
    else
    {
      period = 500;
    }
  }
}

THANK YOU!
I took this code and modified it to work with 4 potentiometers, 2 for seperate LED dimming and 2 for ON time and OFF time, I changed it a lot, but it worked well from this base code. And the LCD screen is updating the values from the pots in real time without any delays.

you were right, the first code I posted was still causing a delay that was causing the lcd screen to update slower as the ON or OFF time was adjusted higher.
7  Using Arduino / Programming Questions / Re: Blink without delay with independent on/off times? on: December 07, 2013, 10:41:10 am
this might be what I was looking for, a 1ms delay is fine with me.

Code:
void setup() {
   pinMode(13, OUTPUT)
}
 
void loop() {
   digitalWrite(13, HIGH);   // set the LED on
   for (int x=0; x < 1000; x++) {     // Wait for 1 second
      delay(1);
   }
   digitalWrite(13, LOW);   // set the LED on
   for (int x=0; x <; 1000; x++) {     // Wait for 1 second
      delay(1);
   }
}
8  Using Arduino / Programming Questions / Blink without delay with independent on/off times? on: December 07, 2013, 10:35:49 am
I'm just wondering if anyone has seen an example of Blink without delay with independent on/off times. (ex. On for 1000ms, off for 500ms) It's easy to do with the the standard blink example but I plan on using a LCD screen to display other info so I can't have a delay. It seems that the standard blink without delay examples I'm seeing have the on/off times locked together so you can only use one time span for on/off.
9  Using Arduino / Motors, Mechanics, and Power / Driving multiple mosfets from one output on: November 15, 2013, 10:12:44 pm
I am thinking about driving multiple mosfets (STP16NF06) from one output. Either direct from an arduino's output, or depending on the distance between each mosfet and the overall distance of the wire (before voltage drop limits me) I may drive the string of mosfets from another transistor and use a higher voltage from another power source as to not overload the arduino output. I think the gate voltage can be up to 20 volts, but full on at I think 4v if I read the datasheet correctly.

this is how my current circuit is connected



could I basically loop the output that's going to the gate over to another gate and connect a 10k resistor, and keep going.. and going until I'm drawing too much current for the output to handle? then I would put a transisor on the output and connect it to a 5v to 20v (probably 12v) power supply with more current. I'm only starting out with two mosfets over a few feet of distance, if this works I will be adding more. The distance, amount of mosfets and voltages in the end to be used are only theoretical right now.
10  Using Arduino / Networking, Protocols, and Devices / Re: RS485 half duplex one-way communication limitation question. on: September 06, 2013, 09:10:43 am
485 was originally spec'd to have 32 "unit loads", IE 32 receiving nodes on a wire.

However modern transceiver chips are rated at 1/4 or 1/8th unit load. Meaning that you should be able to have 4x or 8x as many nodes on a wire, IE 128 or 256 receivers.

But it will depend on a lot on factors such as common mode voltage, environment, speed and wire length. You may have to suck it and see.


_____
Rob


I'm using a Sipex SP485 transceiver chip. From what I can find it's a 1/10 unit load..
11  Using Arduino / Networking, Protocols, and Devices / Re: RS485 half duplex one-way communication limitation question. on: September 05, 2013, 09:21:56 pm
thanks for responding

Quote
In that case you should have no problems having several 'nodes' being on the same network. Standard procedure is to be sure that there are proper sized 'termination' resistors across the pair at both the physical start and end of the wire run.
yup, I planned on following the RS485 standard network design for a half duplex network and having a terminating resistor at the start and end.

Quote
I think you are looking at the most likely solution from a cost Vs performance basis, you will just have to test it out with the maximum cable length and add nodes as you test. With no node(s) answer back communications, how will you know if a node is getting bad messages or not?

well, each "node" will be controlling a 100 watt LED, the data will pretty much be a 0-255 number for the brightness, so if a node is getting a bad message then I guess the light just won't react like it's supposed to.
the arduino on each node is doing other tasks as well, basically monitoring fan speed and temperature and will shut off the light if something happens, it's not necessary to transmit that data back to the master since once again, if there is a problem.. then the light will just shut it's self off, although it would be nice to have it, but I don't need it.
12  Using Arduino / Networking, Protocols, and Devices / RS485 half duplex one-way communication limitation question. on: September 05, 2013, 05:56:21 pm
Using the example from this page
http://arduino-info.wikispaces.com/RS485-Brick

he has setup simple one way communication over a rs485 network, I'm just curious if it's done this way are you still limited to the amount of nodes you can have on one network? no data is being sent back, there is no slave ID, all of the devices are just listening. I'm thinking that if it's setup this way you can have an unlimited amount of devices listening to the master, am I right or wrong? I believe the max amount of nodes on a RS232 half duplex network is somewhere around 32, but that's receiving and transmitting nodes.

Also is there a drawback to this? I'm looking to support at least 100 nodes that are just listening for data from a master, just a simple number.
13  Using Arduino / General Electronics / Re: Reducing power supply noise? on: August 27, 2013, 06:42:41 am
Quote
I have a 10uf capacitor before and after my 7805 regulator.
Do you have a .1uF from the 7805 input to ground (adjacent  to the regulator)?
Show us a picture of your wiring.

Sorry, I don't have a picture at the moment, but my board is setup exactly like this
http://arduino.cc/en/uploads/Main/arduinobb_08.jpg

except where the 2 power connections are going to the 7805 regulator, it's just connected to the DC/DC Convertor to power it. So I should have a 0.1uf cap going from the negative of the 7805 to a ground source? which would be the case that the 36v power supply is housed in.

edit: now that I think about it, I do have the 36vdc negative connected to the 12v negative because I'm using a TIP120 transistor to control a 36v output (high power led), I can separate these with a 0.1uf cap if possible? And I'll check, but I'm sure the 36V is grounded to the power supply case, which is grounded to the 120v ground.
14  Using Arduino / General Electronics / Re: Reducing power suply noise? on: August 27, 2013, 06:36:04 am
Perhaps you have a ground loop? The 36VDC power supply may have its negative output grounded, and the 12V wall wart may have had its output isolated from ground. If that is the case, and the device attached to the serial port is grounded (e.g. a PC, or a laptop running off mains power), then you have a ground loop when running from the 36V supply but not when running from the 12V supply; and a ground loop is likely to mess up serial communication.

sorry for the delay in responding, it's been a busy few days.
That does make sense. If the negative of the 120vAC to 36VDC power supply is grounded, then the 12v coming out of the DC/DC Convertor does not have it's -12vDC grounded. So I should run a wire to the negative ground of the 36V Transformer to the negative of the 12v supply coming out of the dc/dc convertor?

I think the transformer case is grounded to the frame of the box which it's attached to, which is grounded to the 120v main power.
15  Using Arduino / General Electronics / Reducing power supply noise? on: August 23, 2013, 06:59:06 am
When I'm using a 12v 1000MA wall power supply on my breadboard arduino through a 7805 voltage regulator I can communicate with serial just fine, but when I connect my arduino to a DC/DC buck convertor that's being powered by a 36v DC transformer set at 12v out to the 7805 voltage regulator I get garbled serial data. I've read up on these DC/DC Convertors and they seem noisy. I have a 10uf capacitor before and after my 7805 regulator. Is there any other way to clean up the power? maybe use a bigger capacitor before the regulator?

my setup goes like this

120V to 36VDC Transformer (to high power LED's) to DC/DC Buck Convertor (to power 12v fans and arduino) to 7805 regulator to arduino

and yes, I've disconnected the LED's and Fans for testing, I still get a messed up serial output.
Pages: [1] 2