Benutzer-Werkzeuge

Webseiten-Werkzeuge


distanz_sensor_sharp_2y0a_familie

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
distanz_sensor_sharp_2y0a_familie [2020/05/11 13:30] – created 192.168.1.57distanz_sensor_sharp_2y0a_familie [2022/01/09 14:41] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 ====== Distanz Sensore Sharp 2Y0A Familie ====== ====== Distanz Sensore Sharp 2Y0A Familie ======
 +see cpp code in Githup[[https://github.com/zoubworldArduino/ZSharpIR]]
 +
 ===== Sharp 2Y0A710K0F 100-500cm ===== ===== Sharp 2Y0A710K0F 100-500cm =====
-Formel+Python code at [[https://tutorials-raspberrypi.de/infrarot-abstandsmessung-mit-dem-raspberry-pi-sharp-gp2y0a02yk0f/]]
  
 Model: "100500" [100cm to 500cm] Model: "100500" [100cm to 500cm]
Zeile 7: Zeile 9:
 Based on the SHARP datasheet we can calculate the linear function:  Based on the SHARP datasheet we can calculate the linear function: 
 <code> y = 137500x + 1125 which gives us: 1 / ((Volt - 1125) / 137500) = distance_in_cm (For distance > 100cm) </code> <code> y = 137500x + 1125 which gives us: 1 / ((Volt - 1125) / 137500) = distance_in_cm (For distance > 100cm) </code>
 +
 +==== Python code ====
 +<code>
 +#!/usr/bin/python
 + 
 +import spidev
 + 
 +spi = spidev.SpiDev()
 +spi.open(0,0)
 + 
 + 
 +def readChannel(channel):
 +  val = spi.xfer2([1,(8+channel)<<4,0])
 +  data = ((val[1]&3) << 8) + val[2]
 +  return data
 +  
 +if __name__ == "__main__":
 +  v=(readChannel(0)/1023.0)*3.3
 +  dist = 16.2537 * v**4 - 129.893 * v**3 + 382.268 * v**2 - 512.611 * v + 301.439
 +  print "Distanz: %.2f cm" % dist
 +</code>
 +
 +===== Sharp 2Y0A21YK 10-80cm =====
 +
 +Formel
 +
 +
 +Model: "1080" [10cm to 80cm]
 +
 +^Volt ^Distance^
 +|2,6|10 |
 +|2,1|12|
 +|1,85|14|
 +|1,65|15|
 +|1,5|18 |
 +|1,39|20|
 +|1,15|25|
 +|0,98|30|
 +|0,85|35|
 +|0,75|40|
 +|0,67|45|
 +|0,61|50|
 +|0,59|55|
 +|0,55|60|
 +|0,5|65 |
 +|0,48|70|
 +|0,45|75|
 +|0,42|80|
 +
 +Using MS Excel, we can calculate function (For distance > 10cm) :
 +
 +<code>Distance = 29.988 X POW(Volt , -1.173)</code>
 +
  
distanz_sensor_sharp_2y0a_familie.1589196643.txt.gz · Zuletzt geändert: (Externe Bearbeitung)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki