I am using the V5 and coding in PROS as a project which needs a humidity and air quality sensor.
I am wondering if this is possible and how will I wire it up to work with v5. Can I use sensor.get_value() to get the value?
Here is the humidity sensor:
(Can I get both temp and humidity?)
Here is the air quality sensor:
Sorry for all the questions, but I need to know al this. Thanks.
I have already started on the rest of the robot, so…
Is there any way to use I2C at all?
If I use an Arduino, how will I communicate with the V5 brain?
Are there any sensors I can use with V5 directly after rewiring?
As @John_TYler said, the easiest way to interface with V5 would be to get sensors that output analog values in the first place. V5 was not designed to be an open system with native support for Serial or I2C interfaces (that are supported by Cortex).
However, if you have to use I2C sensors you could do that through an I2C enabled board like Arduino. Depending on how much and what type of information you need to communicate to the V5 robot, you have multiple options.
If you just need to send a simple Yes/No bit to the robot, based on the sensor crossing some threshold value, then you can wire one of the digital Arduino output pins to one of the V5 3-wire ports that will let you read 0 or 1 value.
If you need to communicate a range of values back to V5, then you could connect a small capacitor to one of the Arduino PWM output pins and use it as an analog input on one of the V5 3-wire ports.
If you want to send back digital data you could setup two digital pins as low speed bit-bang serial interface between Arduino and V5. As long as it allows > 15-20 ms time between consecutive bits you should be able to do that.
Finally, if you need to send high speed high volume data you could use RS485 or USB interfaces of V5, but that is not a simple task:
My goal at the end of this is to create a robot that drives to a specific location using the vision sensor. Then it will gather humidity (and maybe temperature) and air quality data. If the values seem okay, it will move to another location. If not then the robot will stay there and filter/ humidify the air.
Short answer is no. Neither Cortex nor V5 do not expose SPI interface to the end user. (SD card interface, probably, uses some variant of SPI, but V5 firmware wouldn’t let you use it for arbitrary sensors.)
You will still need to connect any SPI or I2C sensors to another board.
I would suggest you to get an Arduino nano or mini. Use it to read and filter sensor data, and then relay it slowly to V5 brain using a protocol similar to DHT11/22 linked above but at much slower rate. This way you could reuse DHT library code with minor modifications to make it about 1000 times slower to work with V5.
That’s interesting. Are you doing it as an educational exercise?
Because, I would imagine that if you had to dehumidify the area for real on a scale where DHT11 could pick the changes with its +/-5% accuracy, you would need to carry a commercial scale dehumidifier that would require power supply that is well beyond V5 capabilities.
I am doing it for fun and to learn. I am planning to use battery powered purifiers/ humidifiers.
So, if I use an Arduino, I have all my sensors and use them to gather the data, then I can use the output on an Arduino to output the data digital or analog to a 3 wire port (what wiring?). I then can use sensor.get_value() to get the data on the robot side.
Is this correct or is there anything I am missing.
What @technik3k suggested was to very slowly with digital pin send values from the arduino and the v5. 1 bit every 10ms of communication in some cases is totally enough. ( you can get some speedup by using multiple pins at a time)
So the speed is going to depend on you. You have implement some way of communicating the data. Seems the sensor has 4 bytes of data (2 bytes for each temp + humidity) you could reduce this by lowering resolution or lowering precision.
So 32 bits would take 320ms best case, let’s assume another 50% of overhead and we get around 500ms. You could of course make all this parallelized if you wanted so let’s say
500ms / number of ports you dedicate to it.
If you wanted a more robust communication it would be longer but that’s probably fine.
So in the real world scenario we have to do stuff like this to have Allen Bradley talk to Fanuc Robots, what we do is have:
Sensors (1,2,3,…) —> PLC (Or arduino in this case) —> DAC (We call them Amp Cards) —> Fanuc Cell
What we do is have the secondary brain (Arduino) Collect all your data and then send one output
signal when all the conditions are made. If the Fanuc Cell does not get a packet within certain amount of time it will move to certain stage telling the brain to start conditions over.
I would have your Arduino record everything and only send send a ready to move signal (Or alternatively keep pulsing not ready to move yet). Have the V5 look for that one condition and use it to move.