Using library to deal with I2C sensors and EV3

HomeForumsMonoBrick Communication LibraryUsing library to deal with I2C sensors and EV3

This topic contains 5 replies, has 2 voices, and was last updated by Author Image Pascal 1 year, 6 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5566
    Author Image
    Pascal
    Participant

    Hi,

    I browsed the forum, but didn’t seem to find any topic about controlling I2C sensors connected to EV3 brick.

    I’m a senior programmer, and I wrote a .NET software on my PC to make my bot autonomous, taking complex decisions, this software also allows me to control the bot using voice.

    In the first time, I use the legoev3 library (C#), but I would like to add third party sensors like LightSensorArray from mindsensors and RFID reader from codatex, and this library doesn’t handle I2C sensors.
    I try your communication library, but it seems there is the same issue.

    My question is : how can I have access (read and write) to I2C sensors from my PC app (using Bluetooth) ?
    Basically I see two solutions :
    - to use a library which provides a way to communicate with I2C sensors (does the monobrick communication library fits ?)
    - to use your firmware on a sd card, upload a EV3 program which deals with I2C sensors, but it must be able to send and receive data to the PC app (besides does your firmware handle bluetooth ?)

    I’m a bit lost, accessing I2C sensors seems a bit tricky.

    Thanks for any tips

    Pascal

    #5567
    Author Image
    Anders Søborg
    Key Master

    Hi

    Have a look at this file and the sensor class. The file also shows how the Ultra Sonic sensor for both the NXT and EV3 is implemented. It should be possible to get the your I2C sensor working if the sensor is supported by the standard firmware.

    I hope this will get your started.

    /Anders

    #5568
    Author Image
    Pascal
    Participant

    Thanks Anders,

    I had a look at this file, the only function that seems useful is ‘Setup’, but I can’t manage it to work.
    The ultraSonic Sensor seems to be a ‘classic’ sensor (only derives from sensor, with no particularities).

    Thanks for taking the time to answer

    Pascal

    #5571
    Author Image
    Anders Søborg
    Key Master

    Hi

    I must have misunderstood your question. The firmware takes care of detecting the sensor type and therefore also the I2C part. No way to setup I2C via the communication library. But if the firmware supports your sensor then you should be able to read its value.

    Our C# firmware does not official support BT – but has support for WiFi and USB. But working with I2C from our firmware is easy. Just inherit from this class.

    /Anders

    #5573
    Author Image
    Pascal
    Participant

    Thanks Anders,

    Nice, So the solution to my problem will be :
    - Install the EV3 firmware on SD card
    - Install the dll an compile my app (to deal with I2C sensors), I’m using VisuaStudio
    - Manually upload the app on the EV3 (WinSCP)

    But this makes the bot running by itself, How can I interact with my PC app ?
    I saw in samples you have a webserver ? Can I use it to exchange messages between bot and PC ?

    If I had a way to communicate with the firmware, I could setup a kind of server on EV3 which will interpret command messages from my PC App.

    Thanks

    #5574
    Author Image
    Pascal
    Participant

    Hi Anders,

    Browsing the forum, I found useful examples about the way to send/receive message with the Web Server.
    Also thanks for the I2CSensor class, I manage to deal with the LightSensorArray,not yet the RFID sensor.

    I close this subject, and will post any further request or remarks in the Firmware Forum

    Thanks

    Pascal

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Posted in

Make a donation