Tuesday, 17 November 2015

Project: Raspberry Pi / Arduino Television Showcase

I was asked to showcase a poem with the following spec:

Seven TVs will be playing seven different videos and all must be queued simultaneously. This particular project is for a charity so there are obvious budgetary restrictions.

In the past, for multiple video feeds, the cheapest way would have been using DVD players, with obvious control problems.

Thanks to the raspberry pi, this can be achieved for £30 per output, and there are more control options than you can shake a stick at. We were able to achieve less than this thanks to there being a new generation of Pis available and eBay sellers moving them in bulk.

The first thing to do is burn the raspbian operating system to an SD card for each one of the raspberry pis.

I downloaded the image from raspberry pi foundation and used Win32DiskImager to burn the image to each card.

Now we had pi potential, we had to figure out how to power them.
I happened to have an old ATX power supply that I liberated from a PC tower that someone was very kindly throwing into a skip, and due to the low budget of this project I thought that was perfect.

I started by removing the top cover and fan from the power supply and connected all of the cables of the same colour together. I then mounted the fan on the top (and outside) of the ATX, leaving space for connections inside.

From previous experience, I knew that the red wires were for the 5V line and the green wire had to be low (connected to ground) to enable the maximum output of the ATX. but you can see from the chart below the other voltages:

Afterwards, it was a case of stripping back 7 micro USB cables, soldering them together (so they'd take to the connector blocks more easily), and connecting them to 5V and GND.

Always best to check just in case.

What I was then looking at was effectively a 7-way mobile phone charger.

Next thing was to load video files on to each raspberry pi.

I accomplished this by connecting each one to a network switch and a wifi router. Through the routers settings I was then able to bind the raspberry pi MAC address with a given IP address, and then labelled each Pi with that IP, for ease of troubleshooting just in case.
This one shows before I added the switch, not enough ports!!
I then used an sftp program called filezilla to transfer each file to the root folder of the corresponding Pi.

a quick and dirty how to:

 - SFTP uses SSH to transfer files, in filezilla quick connect bar plop in the IP address of the Pi, username and password and port 22, the SSH port open by default on raspbian.
- This then bring up a very familiar drag and drop style file tree, with your local files on the left and the Pi's on the right. Just drag and drop the files to the pi.

After this step was when i realised that the Pis needed to be mounted to make them more manageable.

So I took this board and (I don't advise this looking back on it), took some 30mm screws, and mounted each pi to it.

I had one very early pi that didn't have mounting holes through it so I fastened it down with some plastic cable tie fixings, hence the odd looking one.

I will be continuing with the rest of this project in another post, where I will show the easiest and cheapest way to control several pis at the same time. (HINT: it's not via network).

Monday, 26 October 2015

ESP8266 AT Commands

Here are AT commands that you can pass to ESP8266 via Serial to make it do things.

credit: http://nurdspace.nl 

AT+RSTrestart the modulebasic----
AT+CWMODEwifi modewifiAT+CWMODE=<mode>AT+CWMODE?AT+CWMODE=?1= Sta, 2= AP, 3=both
AT+CWJAPjoin the APwifiAT+ CWJAP =<ssid>,< pwd >AT+ CWJAP?-ssid = ssid, pwd = wifi password
AT+ CWSAPset the parameters of APwifiAT+ CWSAP= <ssid>,<pwd>,<chl>, <ecn>AT+ CWSAP?ssid, pwd, chl = channel, ecn = encryptionConnect to your router: :AT+CWJAP="YOURSSID","helloworld"; and check if connected: AT+CWJAP?
AT+ CIPSTATUSget the connection statusTCP/IPAT+ CIPSTATUS
AT+CIPSTARTset up TCP or UDP connectionTCP/IP1)single connection (+CIPMUX=0) AT+CIPSTART= <type>,<addr>,<port>; 2) multiple connection (+CIPMUX=1) AT+CIPSTART= <id><type>,<addr>, <port>-AT+CIPSTART=?id = 0-4, type = TCP/UDP, addr = IP address, port= portConnect to another TCP server, set multiple connection first: AT+CIPMUX=1; connect: AT+CIPSTART=4,"TCP","X1.X2.X3.X4",9999
AT+CIPSENDsend dataTCP/IP1)single connection(+CIPMUX=0) AT+CIPSEND=<length>; 2) multiple connection (+CIPMUX=1) AT+CIPSEND= <id>,<length>AT+CIPSEND=?send data: AT+CIPSEND=4,15 and then enter the data
AT+ CIPMUXset mutiple connectionTCP/IPAT+ CIPMUX=<mode>AT+ CIPMUX?0 for single connection 1 for mutiple connection
AT+ CIPSERVERset as serverTCP/IPAT+ CIPSERVER= <mode>[,<port> ]mode 0 to close server mode, mode 1 to open; port = portturn on as a TCP server: AT+CIPSERVER=1,8888, check the self server IP address: AT+CIFSR=?
+IPDreceived data