Skip to content

Kgranv/projet_thematique

Repository files navigation

Requirements :

For Raspberry pi

  • Raspberry Pi OS Lite (64-bit)
  • Python 3.10
  • Python Libraries :
    • numpy 1.22.2
    • pandas 1.4.1
    • feather-format 0.4.1

For Windows (optional)

  • Python 3.10
  • Python Libraries :
    • numpy 1.22.2
    • pandas 1.4.1
    • feather-format 0.4.1
    • matplotlib 3.5.2

RaspberryPi recommendation :

  • RaspberryPi type : RaspberryPi-4
  • RaspberryPi name : raspberrypi-projetMOON
  • piUser : projetMOON

Useful command :

For windows with powershell :

  • Connect to raspberryPi with SSH :
    ssh piUser@piName
  • Send file to raspberryPi :
    scp dataToSend piUser@piName:/home/piUser/folderPath
  • Retrieve file from raspberryPi :
    scp piUser@piName:/home/piUser/FilePath localFilePath
    if you are already in localFilePath, replace localFilePath by ".\"

For raspberry-pi terminal :

  • View file in directory :
    ls
  • change directory :
    cd directoryName
    if you want to go in parent folder change directoryName by ..
  • remove file :
    rm fileName
  • read file :
    cat fileToRead
  • start pyhton script
    python script.py
  • start experience script
    nohup python experience.py ftrFile.ftr

How to setup your raspberry-pi :

You need to use the Raspberry Pi Imager software available here : https://www.raspberrypi.com/software/
PiImagerPicture1

Step 1 : Chose OS

You need to chose the Raspberry Pi OS Lite(64-bit). Don't use 32-bit OS because some library needs a 64-bit OS.
You can find it in Raspberry Pi OS (other) menu. PiImagerPicture2 PiImagerPicture3

Step 2 : Chose storage

Select the SD card you will use for the raspberry pi.

Step 3 : Setup advance parameter

You need to change multiple parameter before writing the OS in the SD card :
You can find the parameter in the gear.

  • Chose for all sessions in Image customization options
  • Change the raspberry pi name
  • Activate SSH :
    use authentification by password
  • Define username and password
  • Configurate the wifi

PiImagerPicture4 PiImagerPicture5 PiImagerPicture6

Step 4 : Write on SD card

You can write the OS in the SD card and your OS it's ready !

Step 5 : Install dependencies and Setup directory

You need to install dependencies.

  • Connect to your raspberry pi via SSH :
    ssh piUser@piName
    use the piUser and piName you have setup in step 3.
  • Install OS update :
    sudo apt update
    sudo apt upgrade
  • Install python :
    sudo apt install python3.10
  • Install python library :
    pip install numpy
    pip install pandas
    pip install feather-format
  • Create directory :
    mkdir data
    mkdir userData

All the dependencies are installed you can close the SSH connection by closing the terminal.

Step 6 : Transfert file on raspberry pi

You need to transfert all necessary file on raspberry pi.
Download following file from the repository :

  • armerPompe.py
  • controle.csv
  • controle.py
  • dataPreparation.py
  • experience.py
  • resetGPIO.py

repeat the following command for each file in the list to transfert to raspberry pi :

  • Send file to raspberryPi :
    scp fileToSend piUser@piName:/home/piUser

The setup of the raspberry pi is complete.

Plug experience

Motor

Motor n°1

  • red wire to Mosfet 1 Drain
  • black wire to Mosfet 1 Source

Motor n°2

  • red wire to Mosfet 2 Drain
  • black wire to Mosfet 2 Source

Motor n°3

  • red wire to Mosfet 3 Drain
  • black wire to Mosfet 3 Source

Electrovanne

Electrovanne n°1

  • wires to Mosfet 4 Drain/Source

Electrovanne n°2

  • wires to Mosfet 5 Drain/Source

Electrovanne n°3

  • wires to Mosfet 5 Drain/Source

Raspberry pin

Alimentation

  • pin 4 (Alimentation 5V) to 5 V
  • pin 6 (GND) to GND

Motor

  • pin 11 (GPIO 17) to Mosfet 1 Gate
  • pin 13 (GPIO 27) to Mosfet 2 Gate
  • pin 15 (GPIO 22) to Mosfet 3 Gate

Electrovanne

  • pin 29 (GPIO 5) to Mosfet 4 Gate
  • pin 31 (GPIO 6) to Mosfet 5 Gate
  • pin 33 (GPIO 13) to Mosfet 6 Gate

Run an experience

Step 1 : Prepare your data

The data need to be in csv file. The separator need to be ",".
Your data are presented like this :

time conc1 conc2
0 1 1
2 6 8
10 2 1
15 4 2

time correspond of time from the start in second.
conc1 and conc2 it's the concentration of element at time t.

If you have download dataPreparation.py on your computer you can convert your data on your computer directly. For convert your data directly on your computer follow the Step 3 before the Step 2.

Step 2 : Transfert your data on raspberry pi

Transfert your data on the raspberry pi in the folder userData.
Open terminal in the folder of your data and use this command :
scp dataToSend piUser@piName:/home/piUser/userData

If you have convert your data directly on your computer use this command instead :
scp dataToSend piUser@piName:/home/piUser/data

Step 3 : Convert your data

If you have transfert your CSV file on raspberry pi

  • Connect to your raspberry pi via SSH :
    ssh piUser@piName
  • run dataPreparation.py :
    python dataPreparation.py
    Indicate the name of your data when ask.

Your data is now converted and placed in data.
The data converted is named by the date of creation like this:
year-moth-day_hourminsec.ftr

you can check the name of the data created in the folder data using :
cd data
ls
it will show all the data in the folder data.

If you want convert your data on Windows

Before convert your data on Windows make sure you have the optionnal requirement on your computer.
Create 2 folder in directory of dataPreparation.py:

  • userData
  • data

Put your data to convert in userData folder.
Run dataPrepartion.py and indicate the name of your data when ask.
Your data is now converted and placed in data.
The data converted is named by the date of creation like this:
year-moth-day_hourminsec.ftr
You can check the data created using the script verificationFtr.py
Now you can do Step 2.

Step 4 : Run experience

For start experience connect to raspberry pi if it's not already done :
ssh piUser@piName
Run experience.py in background with :
nohup python experience.py dataToUse.ftr
Close the terminal.
The Experience is running Step 5 and 6 will show you how to interact with experience.

Step 5 : Control experience

If you want take sample or make an observation during the experience you need to suspend the process.

  • Connect to raspberry pi :
    ssh piUser@piName
  • run controle.py python controle.py
  • Chose what you want to do :
    1. Sample
      For take a sample, you need to indicate which quantity you take.
    2. Observation
      For observe the cells.
    3. Restart cycle
      When you have finished your sample/observation restart the cycle.
    4. Log
      For see the last log of the experience.
    5. Stop
      Force stop of the experience if something goes wrong.
    6. Cancel
      Close controle.py

When you have finished dont forget to restart cycle and you can press cancel for close controle.py.

Step 6 : Check log

  • Connect to raspberry pi :
    ssh piUser@piName
  • Open the log:
    cat output.log

For debug log use instead :
cat nohup.out

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •