==== Quelques sites ==== * [[https://www.raspberrypi.org|raspberrypi]] * [[https://raspbian-france.fr|raspbian-france]] * [[https://raspberry-pi.developpez.com/cours-tutoriels|raspberry-pi.developpez]] * [[https://docs.python.org/3/whatsnew/3.0.html|Changements Python 3]] * [[https://www.python.org/|Python.org]] * [[http://www.colorhexa.com/|Couleurs en Hexa]] * [[https://doc.ubuntu-fr.org/python|Ubuntu Python]] * [[http://naelshiab.com/tutoriel-comment-envoyer-un-courriel-avec-python/|Mail]] --> [[https://docs.python.org/3.7/library/email.mime.html|Complément]] * [[https://kivy.org/docs/api-kivy.html|Librairie Kivy]] ==Bazar== * https://anybox.fr/work/docs/livre-blanc-python * http://www.mathslallemand.fr/wp/archives/category/informatique/python-3/kivy ==== Tutoriels ==== === Raspberry === * **Installation Raspbian** avec NOOBS [[https://www.raspberrypi.org/learning/noobs-install/worksheet/|Lien]] * Bien extraire les fichiers du dossier "NOOBS..." dans la carte SD * Possibilité de définir le réseau WIFI au lancement de l'installation * **Adresse IP** de la Raspberry * Tapez la commande **ifconfig** dans le terminal * Visionner le réseau I2C avec les adresses utilisées * Tapez dans le terminal **sudo i2cdetect -y 1** * [[http://apprendre-python.com| Apprendre Python]] * [[http://deusyss.developpez.com/tutoriels/RaspberryPi/PythonEtLeGpio/|Python et le port GPIO]] * [[http://www.jchr.be/python/modules.htm| Modules internes du langage Python]] * Se connecter via **SSH** à partir d'une machine Linux * Tapez la commande **ssh login@ip** dans le terminal * Exemple : **ssh pi@192.168.2.20** pour se connecter à la Raspberry qui a l'adresse IP, 192.168.2.20 * Ensuite il faut entrer le mot de passe, **raspberry** d'origine * Envoyer des fichiers d'un PC à la Raspberry par le réseau via **SCP** (//Secure CoPy//) * Tapez la commande **sudo scp fichier_origine copie_destination** * Exemple : je copie mon fichier code.py qui se trouve sur mon bureau vers le dossier Documents de la Raspberry * **scp /Users/labotim/Desktop/code.py pi@192.168.2.20:Documents** * A l'inverse : **scp pi@192.168.2.20:Documents/code.py /Users/labotim/Desktop** * Il y a possibilité de changer le nom du fichier à l'arrivé * **scp /Users/labotim/Desktop/code.py pi@192.168.2.20:Documents/nouveau.py** * A l'inverse : **scp pi@192.168.2.20:Documents/code.py /Users/labotim/Desktop/nouveau.py** * **Exécuter un code python** * Tapez la commande **sudo python nomfichier.py** dans le **terminal** * **crtl+c** pour **arrêter** le code * [[http://www.framboise314.fr/le-port-serie-du-raspberry-pi-3-pas-simple/#Un_programme_en_Python|Configuration de l'UART]] * **Installation** de [[http://www.waveshare.com/wiki/5inch_HDMI_LCD_(B)|l'écran tactile]] Modifier le fichier config.txt à partir de la carte mémoire ou à partir de Raspbian et un écran de PC **sudo nano /boot/config.txt** ajouter à la fin du fichier: max_usb_current=1 hdmi_group=2 hdmi_mode=87 hdmi_cvt 800 480 60 6 0 0 0 hdmi_drive=1 **sudo reboot** pour relancer la Raspberry et connecter l'écran\\ **Calibrer l'écran**, suivre les instructions suivantes : sudo apt-get install xserver-xorg-input-evdev sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf sudo reboot sudo apt-get install -y input-calibrator [**Seulement pour Kivy**] D'abord lancer l'interface avec la commande **startx** DISPLAY=:0.0 xinput_calibrator Suivre les étapes sur l'écran\\ Copier et garder les caractéristiques du calibrage de ce style : Section "InputClass" Identifier "calibration" MatchProduct "WaveShare WS170120" Option "Calibration" "250 3881 223 3902" Option "SwapAxes" "0" EndSection Copier les caractéristiques dans le fichier suivant : sudo nano /etc/X11/xorg.conf.d/99-calibration.conf OU (si le fichier n'existe pas) sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf **sudo reboot** et la Raspberry redémarre calibrée * Configuration des connexions **Wifi** depuis le **terminal** Arrêter le wifi sudo ifdown wlan0 Démarrer le wifi sudo ifup wlan0 Savoir la liste des réseaux wifi disponibles : sudo iwlist wlan0 scan # pour faire dérouler la liste pas à pas avec Enter sudo iwlist wlan0 scan | more Rechercher seulement les noms des réseaux disponibles sudo iwlist scan | grep ESSID Vérifier sa connexion internet sudo ifconfig Vérifier sa connexion wifi sudo ifconfig wlan0 Ajouter un réseau Wifi à sa Raspberry * Etape 1 : Configurer le fichier suivant sudo nano /etc/network/interfaces supprimer tout ce qui rapport à wlan0 et ajouter à la fin du fichier : allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf enregistrer le fichier * Etape 2: Ajout des réseaux sudo nano /etc/wpa_supplicant/wpa_supplicant.conf Le fichier doit être sous cette forme :\\ (plus la priorité est élevée, plus le réseau est prioritaire) ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
update_config=1 network={ ssid="SSID" psk="password" scan_ssid=1 priority=2 } network={ ssid="SSID2" psk="password2" scan_ssid=1 priority=1 } ==== Librairies ==== == C++/C == * [[https://github.com/WiringPi/WiringPi|WiringPi]], librairie écrite en C permettant l'accès au GPIO de la Raspberry * Visionner les PIN GPIO avec leurs correspondance * Tapez la commande **gpio readall** dans le terminal == Python == * [[https://github.com/adafruit/Adafruit_Python_BME280|Adafruit BME280]] * [[https://github.com/maxlklaxl/python-tsl2591|Adafruit TSL2591]] * [[http://kivypie.mitako.eu/kivy-pie.html|Kivy sur Raspberry Pi]], une libraire pour faire une interface graphique. Possibilité de démarrer une raspberry directement sur Kivy ==== Logiciels ==== * TextWrangler * PyCharm * Adobe Photoshop CC 2017 ==== Composants ==== * [[https://www.adafruit.com/products/2652|Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor]] * humidity with ±3% accuracy, barometric pressure with ±1 hPa absolute accuraccy, and temperature with ±1.0°C accuracy, altimeter with ±1 meter * **Power Pins** * **Vin** - this is the power pin. Since the sensor chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V * **3Vo** - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like * **GND** - common ground for power and logic * **SPI Locgic Pins** * **SCK** - This is the SPI Clock pin, its an input to the chip * **SDO** - this is the Serial Data Out / Master In Slave Out pin, for data sent from the BMP183 to your processor * **SDI** - this is the Serial Data In / Master Out Slave In pin, for data sent from your processor to the BME280 * **CS** - this is the Chip Select pin, drop it low to start an SPI transaction. Its an input to the chip * **I2C Logic Pins** * **SCK** - this is also the I2C clock pin, connect to your microcontrollers I2C clock line. * **SDI** - this is also the I2C data pin, connect to your microcontrollers I2C data line. * default, the i2c address is 0x77. If you add a jumper from SDO to GND, the address will change to 0x76. * [[https://www.adafruit.com/product/1980|Adafruit TSL2591 High Dynamic Range Digital Light Sensor]] * Liste à puceanges from up to 188uLux up to 88,000 Lux on the fly * the I2C address is 0x29 and you can't change it * **Power Pins** * **Vin** - this is the power pin. Since the chip uses 3 VDC, we have included a voltage regulator on board that will take 3-5VDC and safely convert it down. To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V * **3vo** - this is the 3.3V output from the voltage regulator, you can grab up to 100mA from this if you like * **GND** - common ground for power and logic * **I2C Logic Pins** * **SCL** - I2C clock pin, connect to your microcontrollers I2C clock line. * **SDA** - I2C data pin, connect to your microcontrollers I2C data line. * **Other Pins** * **INT** - this is the INTerrupt pin from the sensor. It can be programmed to do a couple different things by noodling with the i2c registers. For example trigger when a conversion is done, or when the light level has changed a lot, etc. We don't have library support for this pin * [[https://learn.adafruit.com/adafruit-ultimate-gps/overview|Adafruit Ultimate GPS]] * [[https://cdn-shop.adafruit.com/datasheets/GlobalTop-FGPMMOPA6H-Datasheet-V0A.pdf|Datasheet]] * [[https://cdn-shop.adafruit.com/datasheets/PMTK_A11.pdf|PTMK Command]] * **Power Pins** * **VIN** - power input, connect to 3-5VDC. It's important to connect to a clean and quiet power supply. GPS's are very sensitive, so you want a nice and quiet power supply. Don't connect to a switching supply if you can avoid it, an LDO will be less noisy! * **GND** - power and signal ground. Connect to your power supply and microcontroller ground. * **Optionnels** * **VBAT** is an input pin - it is connected to the GPS real time clock battery backup. We suggest using the battery spot on the back but if you have a project with a coin cell or other kind of battery that you want to use (and its under 3.3V) you can connect it to the VBAT pin. For V1 and V2 modules: If you do this, be sure to cut the trace on the back between the RTC solder pads * **EN** is the Enable pin, it is pulled high with a 10K resistor. When this pin is pulled to ground, it will turn off the GPS module. This can be handy for very low power projects where you want to easily turn the module off for long periods. You will lose your fix if you disable the GPS and it will also take a long time to get fix back if you dont have the backup battery installed. * **3.3V** is the output from the onboard 3.3V regulator. If you have a need for a clean 3.3V output, you can use this! It can provide at least 100mA output. * **Serial Data Pins** * **TX** - the pin that transmits data from the GPS module to your microcontroller or computer. It is 3.3V logic level. Data comes out at 9600 baud by default * **RX** - the pin that you can use to send data to the GPS. You can use use 3.3V or 5V logic, there is a logic level shifter. By default it expects 9600 baud data, and remember you need to send it checksum'med NMEA sentences * **Others Pins** * **FIX** is an output pin - it is the same pin as the one that drives the red LED. When there is no fix, the FIX pin is going to pulse up and down once every second. When there is a fix, the pin is low (0V) for most of the time, once every 15 seconds it will pulse high for 200 milliseconds * **PPS** is a new pin output on V3 modules. Its a "pulse per second" output. Most of the time it is at logic low (ground) and then it pulses high (3.3V) once a second, for 50-100ms, so it should be easy for a microcontroller to sync up to it