Showing posts with label power. Show all posts
Showing posts with label power. Show all posts

Sunday, October 28, 2012

Assemblage Gertboard - La suite

On continue. Dans l'article precedent on a fait la soudure des composants de surface. On s'assure ici d'avoir la bonne orientation sur ces réseaux SIL de résistances (en jaune). On doit pouvoir lire les marquages sur ces réseaux de ce point de vue:

Les premiers composants apres les CMS. Respecter l'orientation
Les DEL en vert, jaune et rouge (le kit inclus rouge, seulement)
Les supports pour les circuits intégrés

Les 3 boutons sous les DEL

Pour le cristal qui controlera l'horloge du microcontroleur Atmega, il peut etre soudee directement a la carte. Dans mon cas j'ai mis un support pour pouvoir remplacer le cristal pour un a plus haute frequence, dans le futur.

Le cristal (support a 3 pattes)

Pour les barrettes, j'ai remplacé celles qui sont utilisées pour les cavaliers (jumpers) par des barrettes couleur brique. C'est plus facile a visualiser ou vont les cavaliers (pour établir les modes d’entrée et sortie des 12 E/S etc). J'ai aussi remplacé le connecteur a vis, en bleu sur la photo. Il était noir dans le kit de Farnell. Encore une fois, question d’améliorer la visualisation. Finalement, j'ai mis des barrettes optionnelles pour les points 5V5, 3V3 et GND (masse).
Les barrettes de connections simple et double rangées

Le pilote pour les moteurs (sous le connecteur a vis bleu)
Le régulateur TC1262. Notez l'orientation!
Le support pour le fusible
Nous somme prêt a mettre les circuits intégrés
Les convertisseurs analogiques et numériques

Le réseau de transistors pour les relais
Les tampons 74hc244 pour les entrées et sorties
Le Atmega328P (comme les Arduino Uno)

Pour la programmation du Atmega,il faudra utiliser l'environnement Arduino. J'explique comment se le procurer ici: Framboise a la mode Arduino
Le câble d’interconnexion

Le module et un Rasperry Pi pret a l'utilisation

Et voila. Il faut maintenant se procurer les programmes de test:

$ wget "http://www.raspberrypi.org/phpBB3/download/file.php?id=1434" -O gertboard.tar.gz
$ tar vfxz gertboard.tar.gz
$ cd gertboard*
$ make

On execute ensuite les programmes de tests selon le guide de l'utilisateur (en anglais). Je vais mettre des tutoriels sur mon blog au cours des prochaines semaines.
On fait un petit test, ca fonctionne!





Wednesday, October 17, 2012

Arduino power connection hack

About half of my arduinos end up in projects where I flush mount them:

 

I'm sure you figured out the issue with that. The power jack is right next to the USB. And the back of the Arduino has no power input.


But I only want to expose the USB to the outside, to reprogram the arduino, and that is it. The product should be self powered, or have a single cord to connect to the wall socket. An easy hack is to add a connector for +Vin and GND at the back:


Simply solder wires as such:




And a little hot glue to finish the job (on top and under):


I can now connect power from the back. It also clears a shield.

Thursday, October 11, 2012

Framboise a la mode arduino

C'est un jeu d'enfant


Vous aimez le petit support en lego? J'ai trouvé quelques pièces, pas assez pour faire un boitier, mais assez pour faire un support.




Mais, bon, mon Raspberry Pi s'ennuyait tout seul, il lui fallait donc un copain.

Le copain l'Arduino


C'est un Arduino uno. J'en utilise une bonne quantité de ces petits boards a la sauce atmega328. D'ailleurs ce matin, 10 de Octobre, je m'en suis procuré d'autres, a seulement $20 l’unité chez un revendeur sur Amazon - ça c'est vendu en quelques minutes a ce prix. Ca se trouve aussi moins cher, a $15, mais il faut alors attendre des semaines car cela vient de Chine.

C'est une plateforme libre utilisant des microcontrôleurs Atmel, Arduino se référant a la plateforme avec son interface pour carte filles, et Uno a un des modèles.

Je travaille en ce moment sur un projet international avec des Arduino (mon 7ieme projet commercial de ce type) et je vais probablement en commencer un autre vers la fin du mois qui lui ne va pas rester sur Arduino. Le prototype sera sur Arduino, mais le produit final,  ce sera sur le même microcontroleur Atmel Atmega328 avec une carte mère spécialisée.

Quand j'ai commencé avec les microcontrôleurs dans les années 90, il fallait tout faire soit même, et ecrire tout en code machine. Altera, Xilinx, PIC... Maintenant, avec les Arduino Uno et les Parallax Propeller c'est assez simple, c'est comme jouer avec des Lego :)



Ca se branche par le port USB (ou serie). Mon alimentation du Raspberry Pi (une alimentation de mobile Blackberry de 700mA) est suffisante pour alimenter le Arduino uno directement par le port USB:


Par contre si on branche un "shield" (c'est ainsi que l'on appelle les cartes filles en langage Arduino), il n'y a pas assez de jus pour alimenter le shield, sa LED reste éteinte (mais le Arduino lui est ok):


Il faudra donc utiliser une alimentation externe pour cela. Le arduino peut etre alimenter en 5V par USB ou en externe en 7V-12V. Donc ceci fera bien l'affaire, 12VDC 2A:


Je le branche directement a l'Arduino. J'aurais pu le connecter au shield lui-même, mais il y a un avantage a faire cela. Vous allez voir plus bas.



On verifie que le Uno est bien vu par le Raspberry Pi:


pi@raspberrypi ~ $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 009: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)
pi@raspberrypi ~ $ 



L'installation

Avant de faire l'installation du logiciel, du compilateur, de l'environnement de développement pour l'Arduino, on s'assure que Raspbian est bien a jour en faisant un ap-get update (deux fois au cas ou):


Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST 2012 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

pi@raspberrypi ~ $ sudo apt-get update
Get:1 http://mirrordirector.raspbian.org wheezy InRelease [12.5 kB]
Get:2 http://archive.raspberrypi.org wheezy InRelease [7,665 B]
Get:3 http://mirrordirector.raspbian.org wheezy/main armhf Packages [7,376 kB]
Get:4 http://archive.raspberrypi.org wheezy/main armhf Packages [5,738 B]
Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB              
Ign http://archive.raspberrypi.org wheezy/main Translation-en
Get:5 http://mirrordirector.raspbian.org wheezy/contrib armhf Packages [23.3 kB]
Get:6 http://mirrordirector.raspbian.org wheezy/non-free armhf Packages [46.4 kB]
Get:7 http://mirrordirector.raspbian.org wheezy/rpi armhf Packages [14 B]      
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_GB        
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en           
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_GB           
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en              
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_GB       
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en          
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_GB            
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en               
Fetched 7,471 kB in 40s (183 kB/s)                                             
Reading package lists... Done
pi@raspberrypi ~ $ sudo apt-get update
Hit http://archive.raspberrypi.org wheezy InRelease
Hit http://mirrordirector.raspbian.org wheezy InRelease
Hit http://archive.raspberrypi.org wheezy/main armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/main armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/contrib armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/non-free armhf Packages
Hit http://mirrordirector.raspbian.org wheezy/rpi armhf Packages
Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB
Ign http://archive.raspberrypi.org wheezy/main Translation-en
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_GB
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en
Reading package lists... Done
pi@raspberrypi ~ $ 


Je suis a jour, et pas besoin de faire de apt-get upgrade.

Maintenant on fait l'installation. C'est d'une simplicite choquante, apt-get install arduino!


pi@raspberrypi ~ $ sudo apt-get install arduino
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  arduino-core avr-libc avrdude binutils-avr ca-certificates-java default-jre
  default-jre-headless extra-xdg-menus gcc-avr icedtea-6-jre-cacao
  icedtea-netx icedtea-netx-common java-common libatk-wrapper-java
  libatk-wrapper-java-jni libftdi1 libjna-java libnspr4 libnss3 libnss3-1d
  librxtx-java openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
  ttf-dejavu-extra tzdata-java
Suggested packages:
  arduino-mk avrdude-doc task-c-devel gcc-doc gcc-4.2 equivs libjna-java-doc
  icedtea-plugin libnss-mdns sun-java6-fonts fonts-ipafont-gothic
  fonts-ipafont-mincho ttf-wqy-microhei ttf-wqy-zenhei ttf-indic-fonts
Recommended packages:
  icedtea-6-jre-jamvm
The following NEW packages will be installed:
  arduino arduino-core avr-libc avrdude binutils-avr ca-certificates-java
  default-jre default-jre-headless extra-xdg-menus gcc-avr icedtea-6-jre-cacao
  icedtea-netx icedtea-netx-common java-common libatk-wrapper-java
  libatk-wrapper-java-jni libftdi1 libjna-java libnspr4 libnss3 libnss3-1d
  librxtx-java openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
  ttf-dejavu-extra tzdata-java
0 upgraded, 27 newly installed, 0 to remove and 0 not upgraded.
Need to get 58.3 MB of archives.
After this operation, 173 MB of additional disk space will be used.
Do you want to continue [Y/n]? 
[et on y va... longue liste]


On nous suggere d'autres archives, on les installe au cas ou:


pi@raspberrypi ~ $ sudo apt-get install arduino-mk avrdude-doc equivs libjna-java-doc icedtea-plugin libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho ttf-wqy-microhei ttf-wqy-zenhei ttf-indic-fonts
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  autopoint avahi-daemon bind9-host debhelper fonts-beng fonts-beng-extra
  fonts-deva fonts-deva-extra fonts-gubbi fonts-gujr fonts-gujr-extra
  fonts-guru fonts-guru-extra fonts-indic fonts-knda fonts-knda-extra
  fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-deva
  fonts-lohit-gujr fonts-lohit-guru fonts-lohit-knda fonts-lohit-mlym
  fonts-lohit-orya fonts-lohit-taml fonts-lohit-telu fonts-mlym fonts-nakula
  fonts-navilu fonts-orya fonts-orya-extra fonts-pagul fonts-sahadeva
  fonts-samyak-gujr fonts-samyak-taml fonts-smc fonts-taml fonts-telu
  fonts-telu-extra geoip-database gettext git git-man html2text
  icedtea-6-plugin intltool-debian libavahi-core7 libbind9-80
  libconfig-yaml-perl libcurl3-gnutls libdns81 liberror-perl libgeoip1
  libgettextpo0 libisc83 libisccc80 libisccfg82 liblwres80
  libmail-sendmail-perl libsys-hostname-long-perl libunistring0
  libyaml-libyaml-perl libyaml-perl perl-doc po-debconf rsync
Suggested packages:
  avahi-autoipd doc-base dh-make gettext-doc git-daemon-run
  git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn git-email
  git-gui gitk gitweb geoip-bin libyaml-shell-perl groff libmail-box-perl
The following NEW packages will be installed:
  arduino-mk autopoint avahi-daemon avrdude-doc bind9-host debhelper equivs
  fonts-beng fonts-beng-extra fonts-deva fonts-deva-extra fonts-gubbi
  fonts-gujr fonts-gujr-extra fonts-guru fonts-guru-extra fonts-indic
  fonts-ipafont-gothic fonts-ipafont-mincho fonts-knda fonts-knda-extra
  fonts-lohit-beng-assamese fonts-lohit-beng-bengali fonts-lohit-deva
  fonts-lohit-gujr fonts-lohit-guru fonts-lohit-knda fonts-lohit-mlym
  fonts-lohit-orya fonts-lohit-taml fonts-lohit-telu fonts-mlym fonts-nakula
  fonts-navilu fonts-orya fonts-orya-extra fonts-pagul fonts-sahadeva
  fonts-samyak-gujr fonts-samyak-taml fonts-smc fonts-taml fonts-telu
  fonts-telu-extra geoip-database gettext git git-man html2text
  icedtea-6-plugin icedtea-plugin intltool-debian libavahi-core7 libbind9-80
  libconfig-yaml-perl libcurl3-gnutls libdns81 liberror-perl libgeoip1
  libgettextpo0 libisc83 libisccc80 libisccfg82 libjna-java-doc liblwres80
  libmail-sendmail-perl libnss-mdns libsys-hostname-long-perl libunistring0
  libyaml-libyaml-perl libyaml-perl perl-doc po-debconf rsync ttf-indic-fonts
  ttf-wqy-microhei ttf-wqy-zenhei
0 upgraded, 77 newly installed, 0 to remove and 43 not upgraded.
Need to get 49.1 MB of archives.
After this operation, 116 MB of additional disk space will be used.
Do you want to continue [Y/n]? 
[et on y va... une autre longue liste]




On y va


Une fois installé on peut voir sous electronics, le Arduino IDE dans le menu LXDE:


On peut aussi lancer par la ligne de commande l'environnement en tapant:

arduino

D'ailleurs, si on accède a notre Raspberry Pi par l'entremise d'un PC et de ssh -X, l'IDE s'affiche alors sur notre PC, mais roule sur le Raspberry Pi. Une fois que l'on a écrit du code Wiring (du C avec des fonctions spéciales genre analogWrite, digitalWrite etc), on clique sur le bouton avec la coche pour compiler.

Pour transférer le programme executable sur l'Arduino, on clique sur la flèche qui pointe vers la droite. Les relais vont commencer a travailler du moment que le programme est transféré.



Finalement, l'avantage d'avoir l'alimentation sur le Arduino, c'est que l'on peut retirer le Raspberry Pi et notre programme continue de rouler sur l'Arduino, activant les relais sans problemes.


Finalement, il ne s'agit que d'un exemple bien simple. On peut aussi controler l'Arduino avec Firmata (un protocole de communication) et le module Python PyFirmata.

Aussi, de façon générale, je contrôle les relais directement du Raspberry Pi, mais ça, c'est pour une autre fois.

Friday, September 21, 2012

Um centro de entretenimento por $75

Um centro de entretenimento (muito pequeno) por USD$75.
Quase...


Raspberry pi                 $35
Cartao de memoria SD $11
bateria USB 5V               $6
Televisao LCD               $18
cabo de video                  $0.99
OS Raspbian                    $0
XBMC                               $0
MPEG-2                            $3.90

Total US                        $ 74.89


Mas, eu estou em falta uma remota e uma bateria de 12V (ou liga-lo no carro). Ele (Raspberry Pi) funciona para quase 1 hora com bateria USB.

Comparar o tamanho de um iPhone:



O próximo artigo em português será de cerca de Web.py e conexãos de banco de daos, para responder a esta pergunta:  [Web.py] Open and Close a database connection in a request

Thursday, September 13, 2012

Day 0

Someone told me IRL that I was putting the cart before the horse, that I should really have at least one or two posts that explain how to get started with the raspberry pi.

So, here is what you will need to do if you are interested in getting one, but don't know where to start:

1. Buy a raspberry pi. You can do this online, there are a few distributors. Go to raspberry.org to figure out which one to use, based on your country. Or maybe your local hackerspace is doing group buys on them, check them out.
2. Wait a while until you get one delivered to your door.

Seriously, it will take a while, so in the meantime, start shopping or digging around for the other stuff you will need. At a minimum, you will need:

1. A 5v micro usb power supply
2. A 4GB SD CARD
3. A USB keyboard
4. An old tv or color monitor with composite (RCA) in.

It will make things nicer if you also get:
5. A USB mouse
6. A USB hub
7. A wifi dongle
8. A case
9. A USB drive
10. ...

Instead of 4, an HDMI monitor might be a better option, particularly if the Raspberry Pi will be used as a full time desktop computer. The Pi doesn't support VGA directly, but an active adapter can be bought (expensive).

Yes, the $35 computer can cost twice that or more depending on the options.

So, today, we will address point #1, the power supply. Physically, the plug needs to be a micro USB and electrically, it needs to deliver 5V at 700 mA or more (0.7 A). Look around, you probably have a cell phone power supply that will work.

I've used Blackberry Power supplies, quite appropriate for a Raspberry...

But another option I am quite fond of is the Duracell 3 in 1 charger. I've not seen anybody mentioning it anywhere, but i've been using a few for months now and they work well.


It has adapters for iPhone and iPad, motorola, kindle, nook, samsung, lg, blackberry etc.


It is 3 in 1 because you can use it from the wall socket, from 12V (in a car or a solar kit) or from a USB port, including a battery pack (that part is not included). It puts out 4.75V to 5.25V at around 1 A. Perfect match for the RPi.



The tip to use is the micro USB.




So, once everything is connected together, you'll get this:


It sells online for about $13 to $20 but in local discount retail stores (in the USA) I've found them for about $12, so it pays to shop around. If you know of an equivalent product in your neck of the woods, drop us a note in a comment!

Next on our list will be the SD card...

Friday, August 17, 2012