This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RS232 + LED diode

Other Parts Discussed in Thread: CC2530

Hi,

as the topic say, I would ask whether based on sample code ZStack-CC2530-2.4.0-1.4.0 for SmartRF05, am I able to light up a LED diodes connected to the RS232?

As my professor said, on the RS232 should be 12V, so it is possible to connect LEDs there?

He explained that if I will send '1' to  RS232, then there will appear the voltage and will light up the connected LEDs. 

I assume that he meant 3rd pin (TxD - Transmit Data) for one "leg" of LED and for second leg inserted to the GND - Signal Ground.

Is it really possible?

What parameters should I send to the "HalUARTWrite()" function to light LEDs connected in parallel?

In parallel, because if the RS232 voltage is 12V and the diodes are voltage 1.5 V it takes them eight in a row.

Greetings

 

Frankly I do not know if this is correct, but the professor said that this is possible, and say that this is my "homework" to do. I would ask You for help. Thank you.

  • It is unclear why you would want to control an LED in this way.  If this is your homework, you should probably be doing it yourself.  With that said, I would like to point out that 12 volts is likely more than enough to light your led, and it is common to place a resistor in series of appropriate value to control brightness and avoid burnout by limiting current.  (Note:  when you talked about "parallel" you seemed to actually mean series.  You probably don't really want more than one LED.)  I'll let you figure out the rest.  Look for documentation on how to use the HAL functions and/or the UART of CC2530.

     

    -Stephen Kruzick

  • For me the important thing was to find out is it possible :)

    However, I tried to find the information what is the actual output voltage of the RS and what current intensity (X mA). 

    I would also like to ask that, if I will continuing to send information to the RS in result LED will always lighting?

    Relative to the resistor, I wanted to skip it by giving a series of LEDs, it should work?

  • You can put multiple LEDs on the line, but you will burn out your LEDs if the current is too high.  Without a resistor, you will probably end up with short like behavior (in approximation).

     

    I suggest you read up on RS232 on Wikipedia or some other website.  That should answer your questions regarding the voltage level (you'll find there are several possible) and when the LED would be lit (it will depend on what message you send but not just on the bits of message).

     

    -Stephen Kruzick.

  • Ok i will try to buy and find some resistor but:

    On wikipedia I saw that on RS232 we have 12V voltage but i read on other forum that in new computers on RS232 we have 5V.

    And now question is what voltage is on smartrf RS232. And what resister to buy.

    Sory for that, but last thing, my idea to connect two of LED "legs" into GND + TxD (Transmit Data) it's ok or bad?

    I don't want test it and damage smartrfs.

  • I suggest you read the data sheet of your LED and determine how much current you want to pass through the device.  Then find a resistor that will limit it to that amount.

     

    The SmartRF RS232 level is probably 5 volts but you can always probe it or look in documentation.

     

    Your idea will quickly burn out the LED.  If you read more about the waveforms in RS232, you may find that the behavior is not what you expected (idle level, start/stop/parity bits, etc.).

  • Ok, I bought 100 Ohm resistor, 3V LED and put it in series. Then one "leg" set in (3 Pin - TxD) and second to (5 Pin - Ground).

    I opened Generic App Sample, and put in "C/C++ Compiler -> Preprocessor -> Defined Symbols" this list:

    ZTOOL_P1

    MT_TASK=TRUE

    MT_SYS_FUNC

    MT_ZDO_FUNC

    LCD_SUPPORTED=DEBUG

    HAL_UART=TRUE

    HAL_UART_DMA=TRUE

    then I add in HandleKeys on "HAL_KEY_SW_1" event this code:

    // ---------

          HalLcdWriteString("LightLED",HAL_LCD_LINE_1);

          uint8 buf[256];

          uint8 a = (uint8)256;

          while(a)

          {

            a--;

            buf[a] = (uint8)1;

          }

     HalUARTWrite(HAL_UART_PORT_1, buf, 256);  HalUARTWrite(HAL_UART_PORT_0, buf, 256);  HalUARTWrite(HAL_UART_PORT_0, buf, 256); HalUARTWrite(HAL_UART_PORT_0, buf, 256); HalUARTWrite(HAL_UART_PORT_1, buf, 256); HalUARTWrite(HAL_UART_PORT_1, buf, 256); HalUARTWrite(HAL_UART_PORT_0, buf, 256);   HalUARTWrite(HAL_UART_PORT_1, buf, 256); HalUARTWrite(HAL_UART_PORT_0, buf, 256);  HalUARTWrite(HAL_UART_PORT_1, buf, 256); HalUARTWrite(HAL_UART_PORT_0, buf, 256);

          uint16 b = HalUARTWrite(HAL_UART_PORT_1, buf, 256);

          if(b == 0) HalLcdWriteString("Zero",HAL_LCD_LINE_2)

     

    And this doesn't work, what couldbe wrong here?

    Thx.