background preloader

WiringPi

WiringPi

GoPiGo plus GrovePi and Scratch - Dexter Industries Forum Hi, The GoPiGo has 4 ports on it: one each of Serial,I2C,Digital and analog. If you need to use more sensors, then adding GrovePi with the GoPiGo is recommended. The GrovePi does indeed work well with the GoPiGo. You might have to tinker around a bit to get the GrovePi Connected properly with the GoPiGo. The GoPiGo has an extra 28pin header for the Raspberry Pi. You can use both the Ultrasonic sensor and the line sensor and we have scripts written out for both. Do let us know how your project goes and if you end up creating and awesome line sensor robot please share it with us, we’ll be happy to share it with our users. -Karan

Everything You Want to Know About Raspberry Pi GPIO: But Were Afraid to Ask • Circuits Introduction to the Raspi GPIO This article focuses on the Raspberry Pi’s with the 40 pin GPIO connector. In addition to the familiar USB, Ethernet and HDMI ports, the Raspberry Pi offers the ability to connect directly to a variety of electronic devices. These include: Digital outputs: turn lights, motors, or other devices on or off. Digital inputs: read an on or off state from a button, switch, or other sensor. On the Raspberry Pi’s with the 40 pin connector, 28 of the pins are available as GPIO. The Raspberry PI GPIO’s use 3.3V logic levels and are directly connected to the Microprocessor chip. The following Raspberry Pi models have the 40 pin connector available on the circuit board: Raspberry Pi Zero Raspberry Pi Zero W Raspberry Pi Model A+ Raspberry Pi Model B+ Raspberry Pi 2 Model B Raspberry Pi 3 Model B The pin header is marked J8 on the circuit board, and arranged as 2×20 pins with a pitch of 2.54mm. So what do these pin numbers and names mean? Power pins information WiringPi

ArduiPi, the Shield that brings Arduino to Raspberry Pi – ArduiPi is a shield for Raspberry Pi that brings Arduino low level extented I/O to Raspberry Pi This project is now finished and the ArduiPi board available in Seeedstudio shop. Edit 03/17/2014 : New revision of ArduiPi board is now available, version is V1.1. The changes are : Added Auto-Reset Feature of Arduino from Raspberry Pi (connecting Pi GPIO 18 to FDTI DTR)Added a on board switch going to Pi GPIO 17 (mainly to be able to do clean shutdown of Pi )defaulted some PAD wire avoiding doing it to get started with the ArduiPi board. Here are pictures of new board Version 1.1 : Arduipi V1.1 back Pictures of Version 1.0 still available (front, back) Schematic of ArduiPi V1.1 (direct link) : ArduiPi V1.1 Schematic Old revision schematic (V0.9d aka V1.0) is available here Well, quite simple, Arduino is pretty cool but as soon you want to connect it to network, shield are quite expensive and web server will take lot of space into your Arduino and taking some functions off (such as SPI).

Why GPIO Zero Is Better Than RPi.GPIO for Raspberry Pi Projects Advertisement The Raspberry Pi is the perfect computer for learning. The Linux-based Raspbian OS has Python built in, which makes it a great first system for beginner coders. Its General Purpose Input/Output (GPIO) pins make it easy for budding makers to experiment with DIY electronics projects. It’s especially easy when you use code libraries that control these pins, and the popular RPi.GPIO Python library is an excellent example of such a library. But is it the best path for beginners? What Is GPIO Zero? The GPIO Zero library is a Python library for working with GPIO pins. Combining simple naming practices and descriptive functions, GPIO Zero is more accessible for beginners to understand. What’s Wrong With RPi.GPIO? Nothing. Despite its extensive use, RPi.GPIO was never designed for end users. What’s So Good About GPIO Zero? When you are learning Python code, you learn that it should be easy to read and as short as possible. GPIO Zero has a module for LEDs, imported at the start.

using i2c to talk to ardueno Raspberry Pi’s GPIO Speed | Olli's We all know that the raspi is a small and neat device for controlling our LEDs but sometimes I miss the possibility to add hardware to a “real” bus like a real CPU has. Sure it is possible to imitate a bus what is called bit banging. This way you can control external hardware like LCDs or writing data to external SRAM faster than utilizing SPI. So we were interested how fast the Pi can really switch these pins. There are some benchmarks out there but I tried to find the real limit. C code with inline assembler for switching GPIO pin 17 Here is the result: As you can see, this code is able to switch it at 25 MHz and the the curve looks quite good.

RPi Low-level peripherals Back to the Hub Hardware & Peripherals: Hardware - detailed information about the Raspberry Pi boards. Hardware History - guide to the Raspberry Pi models. Low-level Peripherals - using the GPIO and other connectors. Expansion Boards - GPIO plug-in boards providing additional functionality. Screens - attaching a screen to the Raspberry Pi. Cases - lots of nice cases to protect the Raspberry Pi. Other Peripherals - all sorts of peripherals used with the Raspberry Pi. Introduction In addition to the familiar USB, Ethernet and HDMI ports, the Raspberry Pi offers the ability to connect directly to a variety of electronic devices. Digital outputs: turn lights, motors, or other devices on or off Digital inputs: read an on or off state from a button, switch, or other sensor Communication with chips or modules using low-level protocols: SPI, I²C, or serial UART Connections are made using GPIO ("General Purpose Input/Output") pins. Note that no analogue input or output is available. Links Useful P2 pins:

hzeller/rpi-gpio-dma-demo: Performance writing to GPIO with CPU and DMA on the Raspberry Pi Using an Arduino as a slave I/O board Control a slave Arduino from your R-Pi via USB If you have used the GPIO pins and want to move on to analogue input and PWM (Pulse Width Modulation – pseudo analogue output) you need to add extra hardware to your Pi. I suggest you add an Arduino Uno as a first step. You use it as a slave to your R-Pi and control it from Python via a USB cable. Preparing the SD card You a need a 4 GB class 4 card (slow). Install setuptoolsYou need python setuptools to install nanpy on your card. Start Midori and type in the URL box Scroll down to the Linux instructions and then on to the downloads. Close Midori and you should see the egg file in the pi directory. Open the LX Terminal and type in: Code: Select all sudo sh setuptools-0.6c11-py2.7.egg This is a very quick installation. Install serialpyUsing Midori go to pyserial-2.6.tar.gzMake a temp folder and move the downloaded file into it.Using LXTerminal cd .. Testing #!

Accessing The Hardware PWM Peripheral on the Raspberry Pi in C++ · Hertaville.com In this Blog entry I will demonstrate how to access the single hardware pulse width modulation (PWM) channel available on the Raspberry Pi. The BCM2835 SOC on the Raspberry Pi has two PWM peripherals; PWM1 & PWM2. Only the PWM1 peripheral can be mapped onto a GPIO pin (GPIO18) available on the RPi's 26-pin header. It's important to note that both the PWM1 & PWM2 peripherals are used by Raspbian to generate audio, so make sure that the RPI is not generating audio while accessing the PWM peripherals. Since Raspbian/ Linux already assigns the PWM peripherals for audio generation, there's strictly no direct 'proper' way to access the PWM1 peripheral from userspace without accessing the hardware registers directly by 'mmaping into /dev/mem'. The rpiPWM1 Class I developed C++ class 'rpiPWM1' that maps the PWM1 peripheral to GPIO18 and is able to control the PWM frequency, resolution, duty cycle and mode with ease. Here's example code on how to use this class: Setting the PWM Frequency

Add Analog to Digital Conversion Capability to The Raspberry Pi Without an ADC Chip · Hertaville.com One of the few disadvantages of the Raspberry Pi is that it lacks a built-in analog to digital converter(ADC). This can be remedied by connecting a dedicated ADC chip to the RPi Board via SPI (or even I2C). But there are other ways to get analog to digital conversion going on the Raspberry Pi. This entry demonstrates how to add analog to digital conversion capabilities to the Raspberry Pi with a few external components (a comparator, two resistors and a capacitor) and some software. The entire process is summarized as follows: The PWM1 peripheral in the Raspberry Pi is used as a digital to analog converter (DAC) with the aid of a simple passive RC filter. This 'hack' is not new and has been used many times with microcontrollers that lacked built-in ADC's, but had PWM generators. The schematic for the circuit is shown below. Basic ADC Hack schematic Using the RPi's PWM output as a DAC To understand how a PWM peripheral can be used as a DAC, consider the three waveforms below: The Code

□ Reaching 80MHz One of the key design goal of periph.io is to be as fast as possible while exposing a simple API. For GPIO pins, this means having reliable low latency in the happy path. In this article, we’ll describe how we: wrote a reproducible benchmark for GPIO that can be used across platforms, which measures output performance by toggling the output low and high continuously as fast as possible ⎍⎍⎍⎍ and for input performance by, unsurprisingly, reading continuouslyoptimized outputs and inputs against the benchmarksdetermined incorrect optimizations and benchmarking issuesdetermined performance anti-patterns Are we fast yet? Why micro-optimize the GPIO to be as fast as possible? Bit banging, which can be used to emulate a protocol.Software based PWM or Servo.Software-based best-effort logic analyzer.Using as little CPU overhead for devices on CPU bound operation especially in the case of single-core platforms like the Raspberry Pi Zero and the C.H.I.P. All builds were done with Go 1.9.2. Methodology

Related: