Inbetriebnahme der Pixy 2.1 mit Simulink: Unterschied zwischen den Versionen

Aus HSHL Mechatronik
Zur Navigation springen Zur Suche springen
 
(19 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 6: Zeile 6:
|}
|}


= Software Vorbereitung =
Installieren Sie folgende Software
* Simulink Coder
* Simulink Support Package for Arduino Hardware
* PixyMon v2 3.0.24


= Hardware Verbindung mit Originalkabel (ISCP)=
= Hardware Verbindung mit Originalkabel (ISCP)=
Zeile 100: Zeile 105:
[[Datei:LineTrackingI2C R2025a.zip|Demo for Simulink R2025a]]
[[Datei:LineTrackingI2C R2025a.zip|Demo for Simulink R2025a]]
{| role="presentation" class="wikitable mw-collapsible mw-collapsed"
{| role="presentation" class="wikitable mw-collapsible mw-collapsed"
| <strong>Lösung&thinsp;</strong>
| <strong><code>DemoLineTrackingI2C.ino</code>&thinsp;</strong>
|-
|-
|  
|  
'''<code>DemoLineTrackingI2C.ino</code>'''
<syntaxhighlight lang="c" style="border: none; background-color: #EFF1C1; font-size:larger">#include <Pixy2I2C.h>
<syntaxhighlight lang="c" style="border: none; background-color: #EFF1C1; font-size:larger">#include <Pixy2I2C.h>


Zeile 157: Zeile 161:
}
}
</syntaxhighlight>
</syntaxhighlight>
URL: https://svn.hshl.de/svn/Informatikpraktikum_1/trunk/Arduino/ArduinoLibOrdner/Pixy2/examples/DemoLineTrackingI2C/
|-
|-
|}
|}
= SPI laut MathWorks=
[[Datei:Simulink Pixy2 SPI.jpg|thumb|rigth|300px|Abb. 9: Simulink Modellparameter]]
[[Datei:Simulink_Pixy2_SPIwithCS.jpg|thumb|rigth|300px|Abb. 10: Einstellungen des Simulink Pixy2-Blocks SPI with CS]]
[[Datei:PixyMonSPI.jpg|thumb|rigth|300px|Abb. 11: Einstellungen des PixyMon v2 v3.0.24 für SPI]]
[[Datei:Kein Ergebnis Pixy2.jpg|thumb|rigth|300px|Abb. 12: Keine Daten werden angezeigt.]]
{| class="wikitable"
|+ style="text-align:left;"| Tabelle 2: SPI Verbindung Pixy2 10P mit Arduino Uno R3
|-
! Pin !! Pixy 2.1 10P !! Arduino Uno R3
|-
| 1 || SPI MISO || D12
|-
| 2 || 5&thinsp;V  VCC || 5&thinsp;V
|-
| 3 || SPI SCK || D13
|-
| 4 || SPI MOSI || D11
|-
| 6 || GND || GND
|-
| 7 || SPI SS || D10
|}
Error:
  Pixy2 vision sensor supports bit order of 'MSB first' and SPI mode 3. Change the values in the 'SPI properties' of the Hardware board settings and retry.
Lösung siehe Abb. 9
Folgende Einstellungen wurden getroffen
* Einstellungen des Simulink Pixy2-Blocks SPI with CS siehe Abb. 10
* PixyMon siehe Abb. 11
Das Ergebnis (keine Daten) ist in Abb. 12 zu sehen.


= Dokumentation =
= Dokumentation =

Aktuelle Version vom 2. Dezember 2025, 12:15 Uhr

Abb. 1: Kamerasystem Pixy 2.1
Autor: Prof. Dr.-Ing. Schneider

Software Vorbereitung

Installieren Sie folgende Software

  • Simulink Coder
  • Simulink Support Package for Arduino Hardware
  • PixyMon v2 3.0.24

Hardware Verbindung mit Originalkabel (ISCP)

Originalartikel: Hooking up Pixy to a Microcontroller

Abb. 2: Verbindung Pixy 2.1 mit Flachbandkabel mit Arduino ICSP
Abb. 3: Verbindung Pixy 2.1 mit Flachbandkabel mit 10 poligem Stecker
Abb. 4: ICSP des Arduino R3

Steckerbelegung an der Pixy 2.1 (10P)

1  2
3  4
5  6
7  8
9  10 

Die Verbindung der Pixy 2 mit dem Arduino erfolgt über das mitgelieferte 6-adrige Flachbandkabel (vgl. Abb. 2 und 3).

Tabelle 1: Verbindung des 10P ICSP Anschlusses der Pixy 2 mit dem ISCP des Arduino Uno R3
Pin Pixy 2 Arduino ICSP
1 SPI MISO, UART RX, GPIO0 SPI MISO
2 5 V VCC
3 SPI SCK, DAC OUT, GPIO1 SPI SCK
4 SPI MOSI, UART TX, GPIO2 SPI MOSI
5 I2C SCL Reset
6 GND GND
7 SPI SS, ADC IN, GPIO3
8 GND
9 I2C SDA
10 GND

Problem: SPI SS (10P) ist mit Pin 5 des Arduino ICSP nicht verbunden.

Tabelle 2: ICSP Anschluss des Arduino Uno R3 (vgl. Abb. 4)
Pin Arduino ICSP
1 SPI MISO
2 VCC
3 SPI SCK
4 SPI MOSI
5 Reset
6 GND

I2C Verbindung

Abb. 5: Arduino Uno R3 Pinout
Abb. 6: Einfaches Simulink Modell
Abb. 7: Einstellungen des Simulink Pixy2-Blocks
Abb. 8: Einstellungen des PixyMon v2 v3.0.24


Tabelle 3: Handverkabelung des 10P ICSP Anschlusses der Pixy 2 mit dem Arduino Uno R3 (vgl. Abb. 5)
Pin Pixy 2 Arduino Uno R3
1 SPI MISO, UART RX, GPIO0
2 5 V VCC, 5 V
3 SPI SCK, DAC OUT, GPIO1
4 SPI MOSI, UART TX, GPIO2
5 I2C SCL SCL
6 GND
7 SPI SS, ADC IN, GPIO3
8 GND
9 I2C SDA SDA
10 GND GND

SRC

Datei:LineTrackingI2C R2025a.zip

SPI laut MathWorks

Abb. 9: Simulink Modellparameter
Abb. 10: Einstellungen des Simulink Pixy2-Blocks SPI with CS
Abb. 11: Einstellungen des PixyMon v2 v3.0.24 für SPI
Abb. 12: Keine Daten werden angezeigt.
Tabelle 2: SPI Verbindung Pixy2 10P mit Arduino Uno R3
Pin Pixy 2.1 10P Arduino Uno R3
1 SPI MISO D12
2 5 V VCC 5 V
3 SPI SCK D13
4 SPI MOSI D11
6 GND GND
7 SPI SS D10

Error:

 Pixy2 vision sensor supports bit order of 'MSB first' and SPI mode 3. Change the values in the 'SPI properties' of the Hardware board settings and retry.

Lösung siehe Abb. 9

Folgende Einstellungen wurden getroffen

  • Einstellungen des Simulink Pixy2-Blocks SPI with CS siehe Abb. 10
  • PixyMon siehe Abb. 11

Das Ergebnis (keine Daten) ist in Abb. 12 zu sehen.

Dokumentation


→ zurück zum Hauptartikel: Kamerasensor_Pixy_2.1