I connected this sensor with raspberry via UART( I have found that this IR sensor is one of few Lego sensors that connects via UART), and make serial_read and serial_write python scripts, just to test it, but nothing happens (I have dump printed on console). (Before that, I went through whole uart enabling process , enable_uart=1 etc.). On Lego site I have found that after cable connection with sensor, it should start working without any additional setups, but that works with connection between sensor and EV3 brick.(actually first they exchange ack messagge, and then communication begins).
#!/usr/bin/env python import time import serial ser = serial.Serial( port='/dev/ttyUSB0', baudrate = 9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1 ) while 1: x=ser.read() print str(x)
I think that problem is because I am starting communication without ack ( for which I don't know how to implement, there isn't any words about this messagge in docs) messagge, does anybody have similar expeirence?
When I try to send from serial port to cloud, (with java kura framework) I have Error during component activation java.lang.NullPointerException
I connected sensor to USB port of my computer, and used Tera term...
This is what I get :
Baud rate 9600 gives me only Xxxxxxxx and circles symbols.
Baud rate 2400 :
****************************** EDIT v3 ****************************************
From LEGO manual: For UART: " To enable bi-directional and faster communication to external devices the EV3 platform supports UART communication on its input ports. The UART communication functions as asynchronous communication, supporting from 2400 bit/s to 460 Kbit/s on port 1 & 2, while ports 3 & 4 supports up to 230 Kbit/s. The UART communication uses 1 stop bit, 8 data bits and 1 stop bit. To establish UART communication between the EV3 Programmable brick and an external device a specific communication sequence should be followed."
For communication: The external devices start by transmitting back all it configuration values to enable the EV3 Programmable brick to update the system accordingly. Configuration data includes: - Start by keeping UART Tx-pin low for minimum 500 mS. (This will indicate a break condition).
Number of mode the device supports
Supported UART communication speed
It then starts communicating the individual modes supported. The default mode for the device needs to be communicated within mode 0 which also needs to be the last transmitted mode. Start with transmitting the highest mode and end with transmitting mode 0. Good practice is to add 10mS delay between each mode (IE. Transmit all relevant data for the mode and then wait 10 mS before starting in the next mode). o Mode name o Raw value range o SI value range o Symbol o Data format (This data ends the current mode information)
After having sent all relevant mode data the external device should send an ACK and start waiting on an ACK form the EV3 programmable brick. If no ACK is received within 80 mS the external device should reset as not receiving an ACK from the EV3 programmable brick means that the EV3 programmable brick has encounter an error during the communication. By resetting it should automatically start sending its relevant data again.
When an ACK is received the EV3 programmable brick has acknowledge the data and will switch to the requested communication speed and are ready to start receiving data from mode zero.
Please reference the protocol documentation towards how data needs to be packages when sending them back to the EV3 programmable brick. If the data is not packages correctly the EV3 programmable brick will not be able to handle the data correctly.
The EV3 programmable brick automatically sends a NACK command to the external devices every 300 mS. The MINDSTORS EV3 sensors uses this command to reset the internal watchdog timer within the sensor. This enables the EV3 programmable brick and the sensors to continuously be in sync. The MINDSTORMS EV3 sensors re-transmits the last valid data value upon this request. If no feedback values are received within 5 NACK request the NACK command is not send from EV3 programmable brick, this will result in the watchdog not being reset. The EV3 programmable brick will expect a watchdog timeout within the external device which will result in a reset of the external element.