Skip to content

My take on a Raspberry Pi Light Scythe Project

Notifications You must be signed in to change notification settings

djnrrd/LightScythe

 
 

Repository files navigation

LightScythe v3

Credits

This project could not exist were it not for the work of The Mechatronics Guy, and his update. The work I am doing here is largely based on his list of improvements. Credit also has to be given to Adafruit for their code and components - together, you guys have saved me a lot of hard work!

Hardware

As I didn't want to get involved with wiring buttons directly to the GPIO pins on my Pi and it seemed that for images to be selected some form of display would be needed, I opted for the Adafruit 16x2 LCD plate with built in buttons. Assembly was simple but it does require a certain level of dexterity with a soldering iron as there are many pins in a row that need to be soldered precisely.

Of course, for the strip I used 2 metres of the Adafruit Digital LED Strip, so I guess the next step for this is making the scythe itself. Oh, I do so love making things </sarcasm>

But the star of the show is the Raspberry Pi - I have done and intend to do so many things with this device. I run Raspbian, and for any of this to work you need to enable I2C (for the display and buttons) and SPI (for the light strip). To do this you will first need to comment out the modules from the blacklist (/etc/modprobe.d/raspi-blacklist.conf):

#blacklist spi-bcm2708
#blacklist i2c-bcm2708

And then you will need to enable the modules in /etc/modules:

snd-bcm2835
i2c-bcm2708
i2c-dev

In order to allow non-root access to the I2C and SPI pins:

sudo adduser pi i2c
sudo groupadd -f --system spi
sudo adduser pi spi  # This may say that pi is already a member of the group

You will then need to create /etc/udev/rules.d/90-spi.rules (as root) and add the following line:

SUBSYSTEM=="spidev", GROUP="spi"

Give the beast a reboot and she's good to go. You should now be able to run the code without being root.

Software

Well, this is what I have so far. Despite my total lack of Python knowledge I seem to be doing OK. Everything seems to be it the right place, and I have got automatic image resizing, and I have hooked in the original image parsing code. Once you have everything setup, you just need to run:

./Scythe.py

On the first run, it will create a settings.ini file in the project root which will expect the images to be found in /home/pi/images - if it cannot find either the directory or any images the script will terminate. (You can of course change this to any other directory you would prefer to use, but you will need to run the Scythe once first to get the config file.)

When it loads, any images found in that directly will be automatically resized to the correct height, and the resized image will be saved in a "preocessed" sub-directory. You can also set the display colour and timeout here, using the colour constants found in Adafruit_CharLCDPlate.py and any number in seconds for the timeout.

There are many ways to get your Pi to run this script automatically on boot which you will need out in the field, however, the simplest option I found was to use crontab. Just run crontab -e and add the following:

@reboot /home/pi/LightScythe/Scythe.py &

Next Steps

Well, now I need some hardware - I have ordered some of the OpenBeams that I need, and I am in contact with someone who should be able to do the laser cutting for me but the hardest part is going to be attaching the LCD plate to the Scythe. I am hoping I can work something out just using OpenBeam as I really don't want to get into designing custom parts...

About

My take on a Raspberry Pi Light Scythe Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 100.0%