Building a Photon super computer with 2 raspberry pi's

We are just starting out

Here is the video of what we have so far.

We hope others from this blog will come and play too.

2 Likes

Looking good Tony!

When you are ready please share the code that you used for this project! Once it’s all done consider sharing it on the Projects Page so others can build it at home!

For now I’m really curious how you got the pi cameras to read the color. There are lots of people out there doing it but there is not a good writeup on it yet that I can find.

working code

import math
import time
import picamera
import picamera.array
from sense_hat import SenseHat

CAMERA_IMAGE_RESOLUTION = (640, 480) # Resolution of image captured by Camera, Lower the better
IMAGE_SUBSET_RESOLUTION = (8, 8) # Pixels to extract from each image’s center

sense = SenseHat()
sense.clear()
sense.set_imu_config(True, True, True)

with picamera.PiCamera() as camera:
camera.resolution = CAMERA_IMAGE_RESOLUTION
camera.framerate = 8

time.sleep(6)  # Give time to Camera to adjust itself

x, y = IMAGE_SUBSET_RESOLUTION

x1 = None
y1 = None


while True:
    with picamera.array.PiYUVArray(camera) as stream:
        camera.capture(stream, 'yuv', use_video_port=True)
        image = stream.rgb_array

        if x1 is None:
            width, height, _ = image.shape

            x1 = math.floor((width / 2) - (x / 2))
            y1 = math.floor((height / 2) - (y / 2))

        image_subset = image[x1: x1 + x, y1: y1 + y]
        #print(image_subset)
        r=image[x,y,0]
        g=image[x,y,1]
        b=image[x,y,2]
        
        
        print (r,g,b)
        camera1 = (r,g,b)
        #sense.set_pixels(image_subset.reshape(64, 3))
        sense.clear(r,g,b)
    time.sleep(1)
1 Like

I had help, but this is the best i can get working at the moment

am now looking at trying to save the output to a csv.

The Raspberry Pi does only work for a smallish time. It then needs to be restarted