Skip navigation
2016

Are you a student? Here is how you can win up to 1000 USD -

 

1) Show off your cool projects in which you used Simulink by creating a video which explains how you used Simulink.

2) Visit this page and use the appropriate hashtag while uploading your video to YouTube and complete the entry form on it.

 

And as always please share your projects with e14 community and earn the respect of your peers here as well. 

 

For more details and the challenge rules please visit the challenge homepage.

 

PS - reposting from the MATLAB Simulink community.

Hello all,

I'm working with an artist to build an animated sculpture with (originally 1 but now) 16 lights driven by RPI 2b because of a king of random algorithm.

At first sight, as there was only 1 light, ans 2 input switch, I've bought a Piface Digital 2 (available) and a Piface PiRack for future HAT sensors.

But now, i need to drive 16 lights, so i said i put the Piface Digital 2 on the PiRack but this don't work because the PD2 is 40 pins and the Pirack is 26 pins.

And unfortunately the Piface Digital (1) which is 26 pins seems no longer available (but on the Piface's site, the PD2 seems to be discontinued ans the PD1 a regular product).

 

So my questions.

  1. How to drive 16 lights with the RPI 2b according to you (not necessary with PD2)?
  2. What about use the PD2 with a 16 lines mux-demux chip to drive the 16 lights?
  3. How to have multiples daughter board with the 40 pins slot?
  4. Is there a 40 pins Rack like the Pirack for the 26 pins slot?

 

Thank You in advance :-)

oksbwn

Fedora 25 on Raspberry Pi

Posted by oksbwn Oct 25, 2016

 

 

Fedora /fᵻˈdɒr.ə/ (formerly Fedora Core) is an operating system based on the Linux kernel, developed by the community-supported Fedora Project and sponsored by Red Hat. Fedora contains software distributed under a free and open-source license and aims to be on the leading edge of such technologies. As of February 2016, Fedora has an estimated 1.2 million users, including Linus Torvalds, creator of the Linux kernel.

Source: WikiPedia(http://bit.ly/2dEUAFB)
--------------------------------------------------------------------

Subscribe YouTube : https://goo.gl/FhfdL7

 

Guys Subscribe to my channel for latest contents into your inbox.
Support me to keep going.
___________________________________________

Links: Release : http://bit.ly/2eq3dIa

OS Images : http://bit.ly/2dEHHQy

Win32 Sidk Imager: http://bit.ly/2faTtml
********************************************************************

 

Website : http://www.weargenius.in
Twitter : https://twitter.com/geekybikash
YouTube : https://www.youtube.com/weargenius
Instagram : https://www.instagram.com/weargenius/
GIT : https://github.com/oksbwn
Facebook: http://www.facebook.com/geekybikash
_______________________________________________________________

This part focusses on controlling the gpio pins of the Pi using a web based user interface. Ive kept everything as simple as possible and also kept the page layout simple too.

 

Step 1

 

The webserver running on the Pi3 needs permission to access the gpio pins, this can be done easily by adding the webservers user account (www-data) to the gpio group

 

sudo adduser www-data gpio

 

now the pins can be controlled without the need of root permissions which makes things so much easier

 

Step 2

 

We need to create some Python scripts to run the Bash commands that controls the gpio pins, its likely that in a final application all of these commands will be put into a single Python file but to keep things segmented at this stage, a seperate file for each command was used. When Python files are added to the cgi-bin on the webserver make sure to use chown to change the owner of the file to the www-data user and chmod to make the files executable.

 

gpiodirectionin.py

#! /usr/bin/python
#

import os
import sys

os.getenv("QUERY_STRING")  
pinnumber = sys.stdin.read()

p = os.popen("echo in > /sys/class/gpio/gpio"+pinnumber+"/direction")
p.close()

print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "</body></html>"

 

gpiodirectionout.py

import os
import sys

os.getenv("QUERY_STRING")  
pinnumber = sys.stdin.read()

p = os.popen("echo out > /sys/class/gpio/gpio"+pinnumber+"/direction")
p.close()

print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "</body></html>"

 

gpioexport.py

#! /usr/bin/python
#

import os
import sys

os.getenv("QUERY_STRING")  
pinnumber = sys.stdin.read()

p = os.popen("echo "+ pinnumber  +" > /sys/class/gpio/export")
p.close()

print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "</body></html>"

 

gpiounexport.py

 

#! /usr/bin/python
#

import os
import sys

os.getenv("QUERY_STRING")  
pinnumber = sys.stdin.read()

p = os.popen("echo "+ pinnumber  +" > /sys/class/gpio/unexport")
p.close()

print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "</body></html>"

 

gpiovaluehigh.py

#! /usr/bin/python
#

import os
import sys

os.getenv("QUERY_STRING")  
pinnumber = sys.stdin.read()

p = os.popen("echo 1 > /sys/class/gpio/gpio"+pinnumber+"/value")
p.close()

print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "</body></html>"

 

gpiovaluelow.py

#! /usr/bin/python
#

import os
import sys

os.getenv("QUERY_STRING")  
pinnumber = sys.stdin.read()

p = os.popen("echo 0 > /sys/class/gpio/gpio"+pinnumber+"/value")
p.close()

print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "</body></html>"

 

Step 3

 

Rather than use the index.html file from the previous 2 blog posts, I made a new webpage to keep it easy to read. It contains a text field for a user to enter the gpio pin number to control and buttons to operate the pin exporting, direction control and set the high or low. The buttons call javascript functions which interact with the Python scripts above.

 

gpio.html

<html>
<body>
<input type="text" id="pinnumber" style="font-size:2.0em;" maxlength="2" size="1" value="1">
<input type="button" onClick="exportPin()" value="Export">
<input type="button" onClick="unexportPin()" value="Unexport">
<input type="button" onClick="setDirectionOut()" value="Set Output">
<input type="button" onClick="setPinHigh()" value="Set High">
<input type="button" onClick="setPinLow()" value="Set Low">
<script>
function exportPin(){
    var pinnumber = document.getElementById("pinnumber").value;  
    var req = new XMLHttpRequest();
    req.open("POST","/cgi-bin/gpioexport.py",true);  
    req.send(pinnumber);  
}
function unexportPin(){
        var pinnumber = document.getElementById("pinnumber").value;
        var req = new XMLHttpRequest();
        req.open("POST","/cgi-bin/gpiounexport.py",true);
        req.send(pinnumber);
}

function setDirectionOut(){
        var pinnumber = document.getElementById("pinnumber").value;
        var req = new XMLHttpRequest();
        req.open("POST","/cgi-bin/gpiodirectionout.py",true);
        req.send(pinnumber);
}

function setPinHigh(){
        var pinnumber = document.getElementById("pinnumber").value;
        var req = new XMLHttpRequest();
        req.open("POST","/cgi-bin/gpiovaluehigh.py",true);
        req.send(pinnumber);
}
function setPinLow(){
        var pinnumber = document.getElementById("pinnumber").value;
        var req = new XMLHttpRequest();
        req.open("POST","/cgi-bin/gpiovaluelow.py",true);
        req.send(pinnumber);
}



</script>


</body>
</html>

 

There's a video demonstrating the use of this system below, any questions please ask them in the comments and keep a look out for a follow up blog post showing how we can use the pins as input pins and display their values in the webpage!

 

Remotely accessing Raspberry Pi Graphical Interface using smart phone. For this I have used VNC. Virtual Network Computing (VNC) is a graphical desktop sharing system that uses the Remote Frame Buffer protocol (RFB) to remotely control another computer. It transmits the keyboard and mouse events from one computer to another, relaying the graphical screen updates back in the other direction, over a network.VNC is platform-independent – there are clients and servers for many GUI-based operating systems and for Java. Multiple clients may connect to a VNC server at the same time. Popular uses for this technology include remote technical support and accessing files on one's work computer from one's home computer, or vice versa.VNC was originally developed at the Olivetti & Oracle Research Lab in Cambridge, United Kingdom. The original VNC source code and many modern derivatives are open source under the GNU General Public License.There are a number of variants of VNC[2] which offer their own particular functionality; e.g., some optimised for Microsoft Windows, or offering file transfer (not part of VNC proper), etc. Many are compatible (without their added features) with VNC proper in the sense that a viewer of one flavour can connect with a server of another; others are based on VNC code but not compatible with standard VNC.

 

 

Source: WikiPedia(http://bit.ly/2efyASt)

 

----------------------------------------------------------------------------------------------------------

Links :

Instructions for Pi : http://bit.ly/2e8IR3h

Real VNC : http://bit.ly/2dRlCx2

VNC Viewer Windows: http://bit.ly/2dRmemy

VNC Viewer App (Android): http://bit.ly/2dihwu2

********************************************************************

Subscribe YouTube : https://goo.gl/FhfdL7

 

 

Guys Subscribe to my channel for latest contents into your inbox.

Support me to keep going.

___________________________________________

 

 

Website : http://www.weargenius.in

Twitter : https://twitter.com/geekybikash

YouTube : https://www.youtube.com/weargenius

Instagram : https://www.instagram.com/weargenius/

GIT : https://github.com/oksbwn

This post is a demonstration of controlling an i2c device connected to a raspberry pi from a remote device.

 

How it works:

 

The Raspberry Pi sends a webpage to a remote device that contains a text field and a button, when the button is pressed, the text in the field is sent from the web page back to the raspberry pi where a Python script receives the text and forwards it on to an LCD screen connected to the Pi's i2c bus using a library.

 

To achieve this I followed these steps:

 

Step 1

 

Locate and download a library to simplify the use of the LCD, there are some great examples online and finding someone who has already done the hard work and willing to share it is a bonus to any project! I finally settled on a library and an example script of how to use that library from https://gist.github.com/DenisFromHR/cc863375a6e19dce359d thanks Dennis from HR!! I believe that the Pi library didn't fully originate from this source but there are details of that in the Libraries header.

 

The i2c capability on the raspberry pi needs to be turned on before it can be used by typing sudo raspi-config into a terminal and changing the option in the advanced menu. Next the user needs to be added to the i2c group in the linux system sudo adduser pi i2c it's a good idea to add the web server to that group too so remote use is possible sudo adduser www-data i2c.

 

  running the example LCD code in a terminal showed that everything was working correctly with the i2c bus.

 

Step 2

 

A Python script will need to be made that can accept POST data from web browsers and forward that information to the LCD using the library that was downloaded.

 

lcdnetwrite.py

#! /usr/bin/python
#

import os
import sys
import threading
import time
import subprocess
import RPi_I2C_driver


os.getenv("QUERY_STRING")
inputtext = sys.stdin.read()

mylcd = RPi_I2C_driver.lcd()
mylcd.lcd_clear()
mylcd.lcd_display_string(inputtext, 1)


print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "return 1"
print "</body></html>"

print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "return 1"
print "</body></html>"

 

 

Step 3

 

Modify the html file that was created in the first part of the blog to include a text field, button and some java script that can send the information entered into the text field to the Python script that was just made.

 

index.html

<html>
<body>
Raspberry Pi Network Interface Test

<p>
<input type="button" onClick="startLiveUpdates()" value="Begin Updates">
<input type="button" onClick="stopLiveUpdates()" value="Stop Updates">
</p>

<div id="outputarea">output area</div>

<br>
I2C LCD FUNCTIONS
<br>
<p>
<input type="text" id="lcdtext" maxlength="16" size="16" value="text here">
<input type="button" onClick="lcdWriteText()" value="Go">
</p>

<script>

function lcdWriteText(){
var text = document.getElementById("lcdtext").value;
var req = new XMLHttpRequest();
req.open("POST","/cgi-bin/lcdnetwrite.py",true);
req.send(text);
}





var timer_interval

function getPiTime(){
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("outputarea").innerHTML = this.responseText;
        }
    };
req.open("POST","/cgi-bin/basic.py",true);
req.send();

}

function startLiveUpdates(){
getPiTime();
timer_interval=setInterval(getPiTime,1000);
}
function stopLiveUpdates(){
clearInterval(timer_interval);
}
</script>

</body>
</html>










 

----------------------------------------------------------------------------------------------------------------------------------

The video below demonstrates this system working. There is still much to do!!

 

I've always loved the idea of being able to access popular single board computers and their hardware using a HTML browser. Nearly every gadget we own e.g. mobile phones, ipods, tablets, laptops etc.. all have web browser functionality so it stands to reason that if we were to make a user interface that is based around web browsers then all of these gadgets will be able to use it. Many people have at least some knowledge of writing programs for web browsers that they can build upon, most school children are leaving secondary education with some ability to make their own web page too so it's a great way for people to interact with their Raspberry Pi!!

 

Things I have done to prepare the Raspberry Pi 3 before commencing the steps in this blog are:

 

1) Setting up the wireless network adapter with a static ip address (required for simplicity)

2) Installed and configured Lighttpd (A lightweight webserver that is an excellent choice for the Raspberry Pi)

 

--------------------------------------------------------------------------------------------------------

 

This interface is in it's very early stages, currently the rpi3 is able to serve a webpage out to any device with a web browser on the same network as itself, once the webpage loads up there's a button to start live updates and a button to stop live updates. When the start button is pressed, a Javascript module polls a Python script on the rpi3 at 1 second intervals. The Python script returns the current time on the Raspberry Pi to the javascript and that information is displayed on the webpage. - SEE VIDEO BELOW FOR EXAMPLE

 

There might not seem like a great deal of point in just getting and displaying the time remotely but it can be expanded to send/receive data from/to the i2c or spi bus, set/clear gpio pins etc.. any data processing can be done either on the server side using python (raspberry pi) or the processing can be done on the client side using javascript (any device with webbrowser).

 

There are just 2 files used to make this system work at the minute, a standard index.html file and a basic.py file below.

 

index.html

 

<html>
<body>
Raspberry Pi Network Interface Test

<p>
<input type="button" onClick="startLiveUpdates()" value="Begin Updates">
<input type="button" onClick="stopLiveUpdates()" value="Stop Updates">
</p>

<div id="outputarea">output area</div>

<script>

var timer_interval

function getPiTime(){
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("outputarea").innerHTML = this.responseText;
        }
    };
req.open("POST","/cgi-bin/basic.py",true);
req.send();

}

function startLiveUpdates(){
getPiTime();
timer_interval=setInterval(getPiTime,1000);
}
function stopLiveUpdates(){
clearInterval(timer_interval);
}
</script>

</body>
</html>

 

basic.py

 

#! /usr/bin/python
#

import os
import threading
import time
import subprocess

localtime = time.asctime( time.localtime(time.time()) )

print "Content-Type: text/html\n\n"
print '<html><head><meta content="text/html; charset=UTF-8" />'
print "time on rapsberry pi: ", localtime
print "</body></html>"

 

most of the imports in the basic.py file arent required in the code, they are future relics!!

 

A theremin is an electronic musical instrument that can be played without physical contact. The Raspberry Pi utilizes basic image processing algorithms to generate various tones through its on board audio jack. Check out the video here -

 

 

For step by step instructions on how to create this, check out https://www.mathworks.com/matlabcentral/fileexchange/58428-creating-a-visual-theremin-using-raspberry-pi-and-simulink

 

Summary of Functionality:

This project will:

  1. Mark the centroid of a green object with red crosshairs on the live stream from your Pi camera
  2. Generate sound through the Raspberry Pi's audio jack
  3. Change the frequency and gain of the audio based upon the x and y coordinates of the green object on the screen1

                             Connecting the ESP8266  Wi-Fi module to Raspberry Pi.The ESP8266 is a low-cost Wi-Fi chip with full TCP/IP stack and microcontroller capability produced by Shanghai-based Chinese manufacturer, Espressif Systems.The chip first came to the attention of western makers in August 2014 with the ESP-01 module, made by a third-party manufacturer, AI-Thinker. This small module allows microcontrollers to connect to a Wi-Fi network and make simple TCP/IP connections using Hayes-style commands. However, at the time there was almost no English-language documentation on the chip and the commands it accepted.The very low price and the fact that there were very few external components on the module which suggests that it could eventually be very inexpensive in volume, attracted many hackers to explore the module, chip, and the software on it, as well as to translate the Chinese documentation.

 

                            The ESP8285 is an ESP8266 with 1 MB of built-in flash, allowing for single-chip devices capable of connecting to Wi-Fi.

 

Source : WikiPedia (http://bit.ly/2cORmj0)

---------------------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------------------

Links :

Sparkfun AT Guide  : http://bit.ly/2cEzSbv

Schematic : http://bit.ly/2dOBnS2

Py App : http://bit.ly/2dVHANy

Buy ESP8266 : http://amzn.to/2cZfUv8

Getting started with ESP8266 | AT Commands : http://bit.ly/2dBMjEq

 

 

********************************************************************

Subscribe YouTube : https://goo.gl/FhfdL7

 

 

Guys Subscribe to my channel for latest contents into your inbox.

Support me to keep going.

___________________________________________

 

 

Website : http://www.weargenius.in

Twitter : https://twitter.com/geekybikash

YouTube : https://www.youtube.com/weargenius

Instagram : https://www.instagram.com/weargenius/

GIT : https://github.com/oksbwn

Edit: Since writing this item, Linux Kernel 4.8 has official support for the BCM2837 chip on the Raspberry Pi 3 (and now v1.2 of the Pi 2), and the Android kernel also has support for the chip, which has prompted a community build of Nougat for the Pi 3.

 

Edit 2: Google has now released an official version of Android for the Raspberry Pi 3.

 

There has been slight evidence that Google are working on an operating system for the Raspberry Pi with a git repository appearing in the Raspberry Pi 3's name, previously only Eben Upton had teased that Android 4.0 was going to be released for the Raspberry Pi, but unfortunately all we currently have are versions which are not VideoCore optimised, sadly, though RTAndroid does its best.

 

In the recent MadebyGoogle talk which introduced the new Pixel and Home products, they briefly mentioned the "Embedded Google Assistant SDK" which will allow for software development on platforms that can communicate with your Pixel and Home and Chromecast, and that this Google Assistant software will run on the Raspberry Pi.

 

actions-by-google.png

 

Could this be related with the git repository?

 

More than likely.

 

Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. An operating system is the set of basic programs and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi.

 

The initial build of over 35,000 Raspbian packages, optimized for best performance on the Raspberry Pi, was completed in June of 2012. However, Raspbian is still under active development with an emphasis on improving the stability and performance of as many Debian packages as possible.

 

Source : Raspbian (http://bit.ly/2dA3PIb)

---------------------------------------------------------------------------------------------------

Links :

Download  : http://bit.ly/2d4CGfK

 

********************************************************************

Subscribe YouTube : https://goo.gl/FhfdL7

 

Guys Subscribe to my channel for latest contents into your inbox.

Support me to keep going.

___________________________________________

 

Website : http://www.weargenius.in

Twitter : https://twitter.com/geekybikash

YouTube : https://www.youtube.com/weargenius

Instagram : https://www.instagram.com/weargenius/

GIT : https://github.com/oksbwn

Facebook: http://www.facebook.com/geekybikash

Filter Blog

By date: By tag: