The Magpi - December 2014 (issue 29), The MagPi, The MagPi 2014

[ Pobierz całość w formacie PDF ]
//-->ISSUE 29 - DEC 2014Get printed copiesat themagpi.comA Magazine for Raspberry Pi UsersScratchSpacecraftTemperature SensorsExternal StorageProject CuracaoBASIC RoboticsTraffic LightPython GUIA+ ReviewUsing GitOpenCVRaspberry Pi is a trademark of The Raspberry Pi Foundation.This magazine was created using a Raspberry Pi computer.29Welcome to Issue 29 of the MagPi, packed with the usual mixture of hardware projects andprogramming articles, providing lots of avenues for invention during December.With the Christmas holidays drawing near, what could be better than some new Raspberry Pi hardware.For all those looking forward to building a high altitude capsule or autonomous submarine, the Model A+provides many great features for a very low power budget. Dougie Lawson presents a whistle-stop tourof the A+, comparing it to other Raspberry Pi Models.On the subject of robots, computer vision can provide an image cognition solution within manyautonomous robotics projects. Derek Campbell sketches out more features of OpenCV (open sourcecomputer vision) image recognition software.The Raspberry Pi is ideally suited as the hub of a sensor array or control unit, since it can be used topropagate information via a web server or other remote protocol. In this Issue, John Shovic's presentshis final article in the Project Curacao remote monitoring series, David Bannon demonstrates how tobuild and read a simple array of digital temperature sensors, and Brian Grawburg introduces his trafficlight extension board.When developing software or projects, it is important to retain unique files that are part of the build. Inthis Issue, Alec Clews continues his series on software repositories and using Git, and William Belldiscusses the basics of adding external storage to the Raspberry Pi.Computer programming enables the Raspberry Pi to be used within many different applications. Thismonth, Jon Silvera discusses how to drive a robotic arm with FUZE BASIC, William Bell presents asimple space arcade game in Scratch and Paul Suttonintroduces Python graphical user interfaces (GUIs).The MagPi will be taking a short break over Christmasand the first Issue of 201 5 will be published at the start ofFebruary.Merry Christmas and best wishes for 201 5.Chief Editor of The MagPiThe MagPi TeamAsh Stone- Chief Editor / AdministrationIan McAlpine- Layout / Testing / Proof ReadingW.H. Bell- Issue Editor / Administration / LayoutBryan Butler- Page Design / GraphicsMatt Judge- WebsiteNick Hitch- AdministrationColin Deady- Layout / Proof ReadingAaron Shaw- AdministrationDougie Lawson- TestingNick Liversidge- Layout / Proof ReadingMartin Wolstencroft- Proof ReadingDavid Bannon- Layout / Proof ReadingShelton Caruthers- Proof ReadingRita Smith- Proof ReadingClaire Price- Proof Reading2Contents4TRAFFICaLIGHTSimulating bi-directional traffic light8PROJECT CURACAOPart 6: Upgrades on the BeachA+1 4NEW MODELlatest Raspberry Pi hardwareIntroducing theOPENCV1 8INTRODUCINGVision on the Raspberry PiPart 2: ComputerDIGITAL TEMPERATURE SENSOR22Logging temperature with 1 -wire sensorBASIC26FUZEUsing FUZE BASIC to control a robot armPart 5:31EXTERNAL STORAGEtables and rsyncPart 1 : File systems, partition36VERSION CONTROLGit - Part 3Version control basics usingPATCH: GOING BALLISTIC40SCRATCHland on MarsLearning to43THIS MONTH'S EVENTSIreland, Glasgow, SaarbrückenManchester, Lagos, NorthernPIT: MAGIC 844PYTHONGUI with Python'sBALLCreating aTkinter3Simulating a bi-directionaltraffic lightSKILL LEVEL : BEGINNERThe Imagination Station Science Museum inNorth Carolina (USA) offers several RaspberryPi and Python classes and camps. This articleis a shortened version of a project given to thestudents after they've completed about 20 hoursa preliminary exposure to the Pi and Python. Aprevious project introduced the use of an 8 portI/O expander (MCP23008) and providedsufficient background in binary andhexadecimal numbering to enable them tocomplete this project on their own. New to thisproject was the CD74AC02 Quadruple 2-inputNOR gate IC and the use of two MCP2301 7chips (1 6 I/O ports each).Brian GrawburgGuest Writerthen both reds are on for a short timesimultaneously until the cycle starts over.Most intersections with a separate left-turn lanedon't usually activate the left-turn lights if thereare no cars in the lanes. For this projectmomentary push-buttons simulate a car in thelane to activate both left-turn lanes.The MCP2301 7s could be fitted to abreadboard and then wired back to the Pi'sGPIO pins with jumpers, however I decided touse a pre-fabricated Protect Your Pi board fromMyPiShop.com to make the connections mucheasier. In addition, the board can be reused fora variety of projects.Overview of the ProjectA typical traffic signal at a major intersection inthe U.S. has a red-yellow-green light and often aleft-turn signal, also with red-yellow-greenlights/arrows. Although many intersections areasymmetrical as regards turning lanes andtiming, for this project I limited the number totwo symmetrical directions – North(representingnorth-south)andEast(representing east-west).Like a real traffic signal, the Python code turnson the red for one direction while the green andthen yellow are on for the opposite direction;4The project uses 1 2 LEDs and 1 2 resistors; Imade PCBs for the students to use because Ifelt it was much easier to work with a PCB thana breadboard. The CD74AC02 and thepushbuttons, however, are on a breadboard.About the CD7AC Chipproject was trying to incorporate the left-turnoption into the Python code. No doubt therewas a way to do it but I couldn't figure it out (Isaw one possible way, but it required a lot ofcode). Here's where being part of a user groupcan really make a difference. I'm active in theTriangleEmbeddedDevicesgroup(www.triembed.org) and posted a series ofemails to the group; got a great answer that I'musing here.One of the more frustrating aspects of thiswith the normal cycle run the left turn cycle.”Back in 201 0/201 1 I took a year-long course ata local community college on programmingPLCs (Programmable Logic Controllers). One ofthe basic functions is latching an output,meaning that when it is set high it would remainhigh until specifically set low by the program.That's what I was trying to do within the Pythoncode.The CD74AC02 contains four independent 2-input NOR gates as diagrammed below (NORis an abbreviation for NOT OR, two options inlogic construction). I needed to make a latchingSet-Reset flip flop: a logic circuit that has twoinputs and one output. Latch circuits can beeither active-high or active-low.Active-high circuit:Both inputs are normallytied to ground (LOW) by a pull-down resistorand the latch is triggered by a momentary HIGHsignal on either of the inputs.The “problem”: As the lights were cyclingthrough I wanted to push a button to simulate acar pulling into the left turn-only lane which thenactivates something to tell the program “there'sa car that wants to turn so when you're finishedHIGH, and the latch is triggered by amomentary LOW signal on either input.In an active-high latch when the SET input goesHIGH, the output also goes HIGH. When the setinput returns to LOW, however, the outputremains HIGH. The output of the active-highlatch stays HIGH until the RESET input goesHIGH. Then, the output returns to LOW and willActive-low circuit:Both inputs are normally5 [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • shinnobi.opx.pl
  •