issue92:arduino
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue92:arduino [2015/01/07 16:10] – créée andre_domenech | issue92:arduino [2015/03/02 09:04] (Version actuelle) – auntiee | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | This month I begin creating a project that may well come in useful, and practical! My dad has just bought some chickens and wants an automatic way to open and close a coop (sliding) door when it gets light or dark. Enter the Arduino! | + | **This month I begin creating a project that may well come in useful, and practical! My dad has just bought some chickens and wants an automatic way to open and close a coop (sliding) door when it gets light or dark. Enter the Arduino! |
Rather than dismantle my precious laser trip wire, I’m using one of several Arduino Nano’s that I bought from China via eBay. They were only a couple of pounds each, and do the exact same job as the Arduino Uno, except they need to be mounted on breadboard or veroboard as they have no sockets for wires, only bare pins. | Rather than dismantle my precious laser trip wire, I’m using one of several Arduino Nano’s that I bought from China via eBay. They were only a couple of pounds each, and do the exact same job as the Arduino Uno, except they need to be mounted on breadboard or veroboard as they have no sockets for wires, only bare pins. | ||
- | So, basically what I need is to pull a wire (to open the sliding door) when it gets daylight and release the wire (to close the door) when it gets dark. That means I definitely need a servo, a 100uF capacitor, a light dependent resistor (LDR with a 10k ohm pull-down resistor), and I’ll probably use a couple of LED’s (one red, and one green with a 220 ohm pull-down resistor each) to signal the door status. | + | So, basically what I need is to pull a wire (to open the sliding door) when it gets daylight and release the wire (to close the door) when it gets dark. That means I definitely need a servo, a 100uF capacitor, a light dependent resistor (LDR with a 10k ohm pull-down resistor), and I’ll probably use a couple of LED’s (one red, and one green with a 220 ohm pull-down resistor each) to signal the door status.** |
- | My main problems thus far are: | + | Ce mois-ci, je commence à créer un projet qui pourrait s' |
+ | |||
+ | Plutôt que de démonter mon précieux détecteur de mouvement à laser, je vais utiliser un des Arduino Nano que j'ai achetés en Chine via eBay. Ils n'ont coûté qu'à peine deux livres chacun et font la même chose que l' | ||
+ | |||
+ | Ainsi, pour commencer, j'ai besoin de tirer un fil (pour ouvrir la porte coulissante) quand il fait jour et de le relâcher (pour fermer la porte) quand il fait nuit. Cela signifie qu'il me faut absolument un servomoteur, | ||
+ | |||
+ | **My main problems thus far are: | ||
• the servo is always on when the door is open. I need to find a way to hold the wire but stop the servo from whirring as it will inevitably burn out the servo. | • the servo is always on when the door is open. I need to find a way to hold the wire but stop the servo from whirring as it will inevitably burn out the servo. | ||
Ligne 17: | Ligne 23: | ||
My loop() is to read the LDR, then check to see IF the light is near the sun-up value, and, if it is, to open the door, turn the red LED on, the green LED off, and delay for two seconds. Same idea, but in reverse, for sun-down. | My loop() is to read the LDR, then check to see IF the light is near the sun-up value, and, if it is, to open the door, turn the red LED on, the green LED off, and delay for two seconds. Same idea, but in reverse, for sun-down. | ||
- | I’ll keep you updated as to whether I can fix the servo problem, or if I move onto a new project next month. | + | I’ll keep you updated as to whether I can fix the servo problem, or if I move onto a new project next month.** |
+ | |||
+ | Les problèmes rencontrés jusqu' | ||
+ | |||
+ | • Le servomoteur est toujours alimenté quand la porte est ouverte. J'ai besoin de trouver une solution pour maintenir le fil en l' | ||
+ | |||
+ | • Les réglages jour/nuit sont en dur dans le code. Ce serait bien s'il y avait un potentiomètre pour ajuster les seuils. | ||
+ | |||
+ | Le code (sur : http:// | ||
+ | Pre-setup() : initialise le servomoteur, | ||
+ | |||
+ | Setup() : affecte un picot au servomoteur et le met à zéro, déclare les modes des picots pour les LED (et affecte leur état initial) et ouvre le port série pour acquérir les valeurs de la LDR. | ||
+ | |||
+ | Loop() : lit la LDR, puis vérifie SI la valeur est proche du seuil de lever du jour et, si c'est le cas, ouvre la porte, allume la LED rouge, éteint la LED verte et attend deux secondes. Même raisonnement à l' | ||
+ | |||
+ | Je vous tiendrai au courant si je trouve une solution pour le servomoteur ou si je passe à un nouveau projet le mois prochain. |
issue92/arduino.1420643455.txt.gz · Dernière modification : 2015/01/07 16:10 de andre_domenech