Outils pour utilisateurs

Outils du site


issue108:python

Ceci est une ancienne révision du document !


Welcome back. This month will be a hodgepodge of information. The main reason is that there are some important advances in tech and you will need time to get some parts for the next few articles.

In the near future, we will be adding the Arduino into our toolbox. I suggest starting off with the UNO or a UNO clone which can be purchased for less than $30 US (£22). We will also need some sensors to really get going. While these are optional and you can just read the article, building these projects are more than half the fun. So, with that said, here is a list of parts… • One Wire Digital Temperature Sensor - DS18B20 • DHT11 Basic Temperature/Humidity Sensor • 16×2 LCD Display • 4.7K and 10K ¼ Watt resistors (3 or 4 of each) • Large Breadboard (60+ x 10 with power rails) • 10K Potentiometer (2 or 3) • Male to Female jumpers (Pi to Breadboard) about 8” • Male to Male jumpers (Arduino to Breadboard) about 8” • Male to Male jumpers (Breadboard to Breadboard) small to medium • Toy/Hobby motor 6 VDC • L293D or SN754410 Motor Control Chip • 4 AA Battery Holder and Batteries.

This will pretty much get you going for the next few months. Of course, you could get more and explore on your own. Most everything on the list is less than $10 US. If you shop the internet diligently, you can get very good prices on everything really inexpensively. We’ll leave this for now, but for next time, you will need the DS18B20 temperature sensor and a 4.7K resistor as well as a breadboard and jumpers if you don’t already have one.

Recently, there has been a great stir on the Internet about the Amazon Echo / Alexa device software being ported to run on the Raspberry Pi. The biggest reason for the excitement is that currently the Echo / Alexa is available only in the US and many people in the UK and other countries have been waiting, not so patiently, for it. This gives them a chance to enjoy the technology.

There are at least two projects currently working on getting Echo on the Pi. The first uses Java. You can find the code and instructions at https://github.com/amzn/alexa-avs-raspberry-pi. I have done this project on both a Pi Version 1B and the new Pi 3B. It worked well on both. Many people have problems getting this to work, but I did it in about 4 hours (with small breaks and interruptions), and it worked the first time. The best advice I can give you is take your time, plan on a long weekend, and follow the instructions to the letter. The only problem that I had was that npm and nvm needed to be installed, and, at that time, these installation instructions were not included. I believe this issue has been corrected.

The second project uses Python and is located at https://github.com/lennysh/AlexaPi. To be honest, I tried this, but could not get it to run. I will tell you that I did not spend nearly as much time on this project as I did on the Java version, due to many doctor visits this past week. I intend to spend more time on it to try to get it working.

If you decide to try either projects, PLEASE use a blank SD card and not one that has something you want to keep. Load the Raspbian or NOOBS OS from scratch. That way, if something goes wrong, you can just reload the OS and start fresh.

There are some things you need to know before you attempt to do this project. All of the information below pertains to the java version, but some can be considered to apply to both projects… • You need to have a USB microphone. Headphone based microphones have issues. I’m using a Logitech webcam with built in microphone and it works well. • You will also need a set of speakers or headphones attached to the audio out jack. Many people have had lots of issues with bluetooth audio devices. • You must push a button to get the Echo / Alexa to listen for your command. It doesn’t currently listen for the “wake” word. (more below). • Some of the features that the actual Echo / Alexa have don’t currently work. • Things like location, weather, traffic, work correctly only in the USA. In any other country, you will get information for Seattle, Washington, USA • The only supported language currently is English. According to what I was able to find out from my research is that, once the device is being sold in a given country, they will add support for that country's “official” language. I understand that in the UK, the official language is English, and that in the USA, there is no “official” language and that Spanish is a largely spoken language, but is not supported on the device as yet. There are many flame threads on the web – if you wish to voice your ire at the fact that your language of choice is not supported or that the Echo / Alexa is not available there. All I can suggest is that you should be patient. The device was a sleeper for a while and just recently took off well. Amazon, I’m sure, is working on support for other countries right now. • When you start the app, you have to run two processes. The second one will create a GUI box which has a long URL string that you must copy and paste into a web browser. Once that gets to Amazon properly, then you must click the [OK] button on the screen. You will be presented with a screen that has a [Start Listening] button and some multimedia buttons. To “wake” Alexa up, you click the ‘start listening’ button and, after you hear the “ding”, speak your question or command. When finished, you can click that button again to have it stop listening and process your command, or you can let it timeout (about 5 seconds) then it will start processing. Many people are working on headless operation (no monitor) and a physical button connected to a GPIO pin, and some are actually working on the “wake” word option. You can find more information in the issues section. • You should (read MUST) use a decent quality SD card. My suggestion is to get nothing less than a Class 10 card that is no smaller than 16 Gig. • As soon as you boot into the new operating system for the first time, run a ‘sudo raspi-config’. Be sure to enlarge the file system to take in the entire card. Be sure to turn SSH on. You will need to reboot here. Next you should then do a ‘sudo apt-get update’ and then a ‘sudo apt-get dist-upgrade’ so you are at the latest software revisions. • There are some steps that require you to enter certain data. Make notes of what you entered, either by a screen shot, into your smartphone, or (HORRORS!!!!!!) on paper. It will make things easier. • If you have any problems, check the issues section. More than likely someone has already had the same problem and there might be a fix. • Print the web page with the instructions and work off the print. This way, you can check off those steps you have already completed. Especially helpful if you get interrupted. • You can find more information, and change certain settings, at alexa.amazon.com. I understand that some people who are not in the USA have problems with this site.

I think that’s enough for this month, but next month, we will turn our RPi into a thermometer. The neat thing about using the DS18B20 sensor is that you have more of them on a single line. This way, you could use one in the living room, one outside, etc. We’ll use these sensors later on with the Arduino and be able to use the arduino as a remote device so we don’t have to try to run a long cable and change the resistance to a point that it won’t work.

Until next month, enjoy checking out the Alexa project, and, if you try it / them, hope you have success.

issue108/python.1462032800.txt.gz · Dernière modification : 2016/04/30 18:13 de auntiee