Pages

Saturday, April 25, 2015

Since the S7-200 is a bit different then the newer S7-1500/S7-1200 PLCs it took a bit of work to get it working. The python-snap7 library was missing the connection method for the old TSAP method of connecting. So I forked the library and added the missing function to connect. I did a pull request to get it merged back with the original and it's pending currently. Here is the link to the forked library:https://github.com/SimplyAutomationized/python-snap7

I've also been working on a din rail enclosure for the pi that wasn't so large. I'm going to be adding a 24vdc to 5vdc dc-dc converter to the enclosure it so I don't have to bring in usb to it.

Anyway back to the good stuff. I added the Cli_Connection in the Client.py library so the code will now be as follows:

Friday, April 17, 2015

UPDATE (4-17-2015):

To see "Part 1" of this project please go here
So we have few new features!!

Ability to hide/show clock and temperature via phone webapp

Change time between image transitions via webapp

Uploading multiple images from the web interface now works.

Deleting Images now works.

Lazy loading of images when looking through them on the webapp. (loads as you scroll)

I just added a 3-axis sensor to the 7" frame and have it broadcast to the HTML side the angle of rotation.

TODO(Coming Soon)

Weather feed option in the config. (see weather every 10 slides, and or outside temperature in right hand corner)

DNLA Support for those who have NAS servers with millions of images.

Option to only show images of the same aspect ratio as your picture frame rotation.(if you frame is vertical show vertical taken images and visa vera)

piframe image for download so no setup is required (except hardware)

Details on the new webapp features

To make it more handy to have a IoT picture frame I've added some handy configurations that load when the frame starts up.

Details on the Acceleromter

I updated the git repository with a class to communicate via i2c to a MMA7455 accelerometer.https://github.com/SimplyAutomationized/piframe/blob/master/MMA7455.py
The class has a callback method within it so it can broadcast a tilt change to whomever instantiates the class. Which I'm calling it within the websocket code and broadcasting to the client(the frame) the correct angle.

#I check the config file to see if you have enabled the tilt sensor

if(config['tiltsensor']):
self.tiltSensor=tilt.TiltSensor(self.rotateFrame)
self.tiltSensor.start()
#...later in the code we define the callback rotateFrame when rotation changes.

#(when the X axis inverts)
def rotateFrame(self,data):
rotation=data*270
self.frameconfig.changeKey('rotation',rotation)
self.sendNewConfig(self,all=True)
#the code then broadcasts it's new rotation, the CSS on the frame then rotate's the images based off of the new rotation :-) win!

Monday, April 6, 2015

It was an interesting process to sniff and break apart the ECOM protocol. But with the help of Wireshark I was able to create a simple class to read/write Inputs,Outputs,V Memory, and C Memory Bits. My class may look a bit hokey to those more skilled at python than I, but I've found it very usefull.

If you're stuck with an old generation H0-ECOM ethernet module and want to make use of it this post may be of use to you. I was able to get a few from work as we phased in new gear. We only had a couple ECOM-100 modules (ModbusTCP). So I was driven to get these working with my Raspberry Pi.

With mine I made a raspberry controlled sprinkler system using the Koyo DL-06 as my remote I/O. There was no logic programmed into the PLC because I wanted my pi to control it 100%. But with this python code anyone could make a raspberry pi powered cheap HMI or web based HMI for their system.

Saturday, April 4, 2015

In my search (hours upon hours upon days..) through the many picture frame pi tutorials I didn't quite find one that was fine tuned for what I wanted. I wanted to control it with my phone (upload, change , remove, and modify images). I tried the following (Pros/Cons):

FBI, Frame Buffer Imageviewer.

Pro: easy to setup and had slideshow modes.

Cons:

No layering if you wanted to put a clock or temperature on the top.

Took lots of ram to buffer all the images up.

No web interface.

Pygame:

Pros:

Python based, and I like python, which could give you a web interface.

So I took a bit of the FBI, and used some Raspberry Pi kiosk tutorials (can't think of which ones I used, just google some to find it) and mixed it into the mighty HTML5 one!!. Here's the parts list if this is your first RPicFrame:

A Picture frame the you can attach your screen to. (May be difficult to find)

I luckily had a philips 10" digital picframe that I found at a garage sale for $15, gutted the lcd driver board and ordered one compatible with the lcd screen. (not always going to work) Also found the 7" digital picture frame at goodwill and gutted it and found a compatible driver (which barely fit with the Model A+).

Some people are skilled with woodworking as I've seen in other rpi pictureframe tutorials. You may be also.