• Aucun résultat trouvé

Fiche Réalisation Mécanisme d alimentation programmable. Titre : Mécanisme d alimentation programmable Type de réalisation :

N/A
N/A
Protected

Academic year: 2022

Partager "Fiche Réalisation Mécanisme d alimentation programmable. Titre : Mécanisme d alimentation programmable Type de réalisation :"

Copied!
6
0
0

Texte intégral

(1)

Fiche Réalisation

Mécanisme d’alimentation programmable

Titre : Mécanisme d’alimentation programmable Type de réalisation :

ensemble électronique

Concepteur : Brice Detailleur

Courriel : brice.detailleur@univ-amu.fr Durée estimée : 1 Jour Date de la réalisation :22/02/2017 Fichiers associés : Neant

Objectif

Dans cette fiche, nous créons un dispositif de distribution de nourriture, sous forme de poudre pour des cages à souris. Le dispositif est piloté par une interface arduino équipé d’une horloge (RTC) programmable et d’un servo moteur pour permettre la rotation du réservoir contenant la nourriture. Ce dispositif est place au-dessus de la cage à souris.

Matériel (Liste/Références/Fournisseurs/Prix unitaires et coût global du matériel nécessaire)

Description Fournisseur Référence Nombre PU HT

Un

microcontroller de type Arduino

RS radioSpare Ex : UNO REV.3 715-4081

1 20€

Module RTC Robot Maker 1 1,80€

Servo moteur Go Tronic 31760 1 4,95 €

(2)

Réalisation

1 Schéma fonctionnel

(3)

Pour toutes informations, fichiers (CAO et impression 3D),

Contacter : brice.detailleur@univ-amu.fr du GT Prototypes, pilotage et périphériques du RTMFM.

(4)

4 Firmware Arduino

Deux firmaware sont à appliquer. Le premier est à téléverser dans l’arduino pour mattre à l’heure la RTC. Une fois fait il faut installer la pile dans le RTC.

Téléviser ensuite le second firmware pour piloter le dispositif

Firmware de mise à l’heure du RTC //Mise à l'heure RTC

#include <Wire.h>

#include "RTClib.h"

RTC_DS1307 RTC; //Classe RTC_DS1307

void setup () {

Serial.begin(57600); //Démarrage de la communication Wire.begin(); //Démarrage de la librairie wire.h

RTC.begin(); //Démarrage de la librairie RTClib.h

//Si RTC ne fonctionne pas if (! RTC.isrunning()) {

Serial.println("RTC ne fonctionne pas !");

//Met à l'heure à date à laquelle le sketch est compilé RTC.adjust(DateTime(__DATE__, __TIME__));

//Cela fonctionne également :

//RTC.adjust(DateTime("Dec 5 2012","12:00:00"));

//RTC.adjust(DateTime(2014, 1, 21, 3, 0, 0));

} }

void loop() {

//Affichage de l'heure DateTime now = RTC.now();

Serial.print(now.day(), DEC);

Serial.print('/');

Serial.print(now.month(), DEC);

Serial.print('/');

Serial.print(now.year(), DEC);

Serial.print(' ');

Serial.print(now.hour(), DEC);

Serial.print(':');

Serial.print(now.minute(), DEC);

(5)

Serial.print(':');

Serial.print(now.second(), DEC);

Serial.println();

delay(3000);

}

Firmware de pilotage

#include <Wire.h>

#include "RTClib.h"

int periode=20000; //Temps entre chaque début d'impulsion en microsecondes int leServo=8; //leServo est connecté à la pin 8

RTC_DS1307 RTC;

void setup () {

Serial.begin(57600); //Démarrage de la communication Wire.begin(); //Démarrage de la librairie wire.h RTC.begin(); //Démarrage de la librairie RTClib.h

if (! RTC.isrunning()) //Si RTC ne fonctionne pas {

Serial.println("RTC ne fonctionne pas !");

}

pinMode(leServo,OUTPUT); //On prépare le pin 8 en mode OUTPUT digitalWrite(leServo,LOW); //On l'initialise à l'état bas

}

void setAngle(int a) //Fonction setAngle pour envoyer les impulsions {

int duree=map(a,0,179,500,2500); //On transforme l'angle en microsecondes //et on stocke dans la variable duree

digitalWrite(leServo,LOW); //On met le pin à l'état bas

for (int t=0;t<300;t++) //Cette boucle est nécessaire pour laisser //le temps au servo d'aller à sa position

{

digitalWrite(leServo,HIGH); //On envoie l'impulsion delayMicroseconds(duree); //Pendant la bonne durée digitalWrite(leServo,LOW); //On stoppe l'impulsion

delayMicroseconds(periode-duree); //On attend le temps restant

(6)

//pour atteindre la période }

}

void loop() {

//Affichage de l'heure DateTime now = RTC.now();

Serial.print(now.day(), DEC);

Serial.print('/');

Serial.print(now.month(), DEC);

Serial.print('/');

Serial.print(now.year(), DEC);

Serial.print(' ');

Serial.print(now.hour(), DEC);

Serial.print(':');

Serial.print(now.minute(), DEC);

Serial.print(':');

Serial.print(now.second(), DEC);

Serial.println();

delay(3000);

if (now.dayOfTheWeek() == 4 && now.hour() == 11 && now.minute() == 08) //Jour de la semaine : 1 pour lundi, 2 pour mardi, ...

{

for (int angle=0;angle<=90;angle+=30)

//On fait varier l'angle de 0 à 90° par pas de 30°

{

setAngle(angle); //On appelle la fonction setAngle }

setAngle(0); //On fait revenir leServo à le position 0

delay(60000); //On attend 60 seconds pour éviter un deuxième cycle }

}

Références

Documents relatifs

Forced vectors work much the same way as forced pins, except that all pins are dis- connected from the target system's stimulus and placed under the control ofthe MESA-I

Data I/O's Programmable Logic Development System (PLDSl is the premiere logic work- station offering extensive support for virtually every programmable logic

With Logic programming the AN D/ORlEx-OR gate input connections necessary to implement the desired logic function are coded direcrty from logic equations using the

After initial power-up the TMS 9901 is accessed only as needed to service the clock, enable (disable) interrupts, or read (write) data to the I/O ports.. The I/O ports can

The time interval between the specified reference points on the input and the output voltage waveforms with the three-state output changing from the defined high level to a

The ATmega8 provides the following features: 8K bytes of In-System Programmable Flash with Read-While-Write capabilities, 512 bytes of EEPROM, 1K byte of SRAM, 23 general purpose

The ATmega8 provides the following features: 8K bytes of In-System Programmable Flash with Read-While-Write capabilities, 512 bytes of EEPROM, 1K byte of SRAM, 23 general purpose

Pour faciliter le montage , il existe la solution Grove via un shield Grove qui se connecte directement sur la carte Arduino et qui dispose de plusieurs prises. Chacune