I want to experiment with some sensors with my Raspberry Pi 3. For that, I searched for sensors to buy online. During the search some websites says "buy sensors for Arduino" and some says "buy sensors for Raspberry Pi". So. if I buy sensors for Arduino, will they work with Raspberry Pi or not?
-
2I'm voting to close this question as off-topic because it's about hardware. – gre_gor Nov 05 '17 at 21:32
-
"Do train wheels work on my VW Golf?" – too honest for this site Nov 05 '17 at 21:35
1 Answers
'it depends" being the answer.
The short answer is: yes probably it will work on both.
The longer answer is you'll be doing some work arounds. (and each is case dependent).
For example the arduino has analog pins, but AndroidThings boards do not - you would need to use a Analog to Digital converter (like this or any other ADC).
Android Things supports these protocols & interfaces - I2C - SPI - UART - PWM - I2S
If the peripheral uses one of these, then yes it will more than likely work an AndroidThings (a raspberry pi).
AT also supports GPIO. However if the sensor only uses GPIO, it is likely to require a fast communication speed (in the range of 10's of nano seconds), but Android Things GPIO is slow (the frequency is in the range of 300± nano seconds) - so you'll probably find these sensors are not supported on AT (a raspberry pi).
If after all that you buy a sensor and it won't work with Android Things - you can still use the sensor with an Arduino board and then control the Arduino Board with a Raspberry Pi as a master (like this).

- 75,855
- 30
- 208
- 233
-
2SPI is not a protocol, nor are UART or PWM. I2C is just basic. None has higher layer functions. Said that: please refrain from answering off-topic questions. With 50k reps, you should help moderating the site and close-vote them instead. – too honest for this site Nov 05 '17 at 21:51
-
1"is just basic" is not a definition. Your idea of protocol is clearly different to mine. If I said "protocol/interface" would it please you? -1 for an answer that will clearly help the person is pretty pathetic just to try and "follow the rules". Closing a legitimate question doesn't help anyone. If anything it should be migrated and if it was migrated the answer would go with it. Therefore I am happy I helped this person by answering the question. – Blundell Nov 05 '17 at 22:03
-
3You want to read [ask] to see which questions to answer and which to close. Also you should not assume someone leaving a comment is the same person who downvoted! And the question is clearly not legitimate **here**. – too honest for this site Nov 05 '17 at 22:17
-
"clearly" is not the case. The reason for the close is "general hardware" of which arduinos and rPis are not. OP is clearly a programmer and this person seems to have written a helpful answer. – ataulm Nov 05 '17 at 23:13
-
1What's wrong with you guys? If someone wants to help, then let him help. Do not hang with how to ask instead concentrate on the mottos of this website. – Farooq Ahmad Nov 06 '17 at 14:05