Automatically run Electron application at reboot on Raspberry Pi

Here is a quick  way to have an application built on electron run at boot on a Raspberry Pi. This worked for me running Raspian Stretch with Desktop.

Edit /home/pi/.config/lxsession/LXDE-pi/autostart with nano:

Add the following line:

The file should now look somewhat like this:

Save and exit nano and reboot. Your app should open after the desktop environment loads. Yay!

If you want to be able to get access to the terminal output of your application, install screen with:

And then swap:

For:

In the above code snippets.

After the pi boots, you can run screen -list to see what screens are available to attach to then attach to yours with screen -r yourscreen. Here’s an example:

Press enter, and then see your terminal output.
For more info on how to use screen, check out this link:

https://www.gnu.org/software/screen/manual/screen.html

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

CHAMP: Compliant Hook Arboreal Mobility Platform (Senior Thesis Project)

For my senior thesis project at WPI, myself and two colleagues (Rachael Putnam – RBE/ME and Mead Landis – RBE/ME) designed a tree climbing robot. I was in charge of designing and implementing the electronics and controls software. I was the most intense project I have ever worked on, both in terms of difficulty and potential impact. Here is our poster for project presentation day:

Here’s a video of the prototype climbing:

We did a blog during the project, here is the best post I wrote:

The report is massive, check it out below:

CHAMP_REPORT

 

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Find distance between two zipcodes, dump the result in an excel file

I recently wrote a piece of software for a friend working on a project, you can find it on github here. The following is from the README.md:


zipcode-distance-excel

This is a command line utility to automatically calculate the distance between two zipcodes and then put the results in an excel (.xlsx) file. It works for US postal codes only.

It was developed to help a colleague and is very application-specific.

Prerequisites

Downloading is easy git, which is already on most systems, on ubuntu use:

For everyone else:

Installing

A step by step series of examples that tell you have to get a development env running

Say what the step will be

Usage

in a directory with the .xlsx file that you want to modify, run:

The program skips the first row in the spreadsheet to avoid headers.

Example Usage

Before:

Before

Terminal output:

After:

After

Authors

  • Devon Braysite
  • Miranda Lawellsite

License

This project is licensed under the MIT License

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

#codehell 1 – Electron cannot be started from an SSH session

Update: If you run export DISPLAY=:0 in the terminal prior to npm start, the application runs just fine on the remote device. Thank you Alex!


In working on an project for work, I have figured out the hard way that Electron has to be started from a terminal session on your target device (ie the computer it is to be viewed on). I am developing an embedded system based on the Raspberry Pi that does not take user input but displays information on a screen.

Upon downloading the electron-quick-start example, everything installs correctly without error and can be done remotely via SSH. Upon running with npm start, the following error is thrown.

I spent most of the evening trying to debug npm ERR! code ELIFECYCLE to no avail. On a lark, I connected a keyboard to the device and ran npm start and it ran without error. Sigh.

The remote development alternative for doing this is to use Remote Desktop Connection a client comes bundled in with windows. The software can be installed on the remote system (the Raspberry Pi) using apt-get install xrdp. Upon connecting, opening up a shell in the RDP client, and running npm start, the example application works just fine.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Soft-latching toggle switch with active reset circuit

This circuit aims to replace a traditional toggle switch for switching large amounts of current. Instead of the bulky and expensive traditional toggle switch, this circuit allows for a cheap pushbutton, and a few transistors and resistors to be used and have the same effect.

For my application, I wanted a way to have the circuit draw very little curren
t when in the off state, be able to be powered on with a pushbutton, and then turned off through software on the Arduino.
Here is the circuit diagram:

Here’s a video of the circuit in operation:

The code running on the Arduino is very simple:

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Comparing blank string definition in Python3

In python3 using

or

Produces the same result for the programmer. Which one is faster? Using the python module timeit, it’s really easy to find out!

Using string="" is WAY faster.

Here’s the source code for my tests:

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

StripPi – Software Demo, Roadkill Electronics

I’m constantly loosing the remote for my RGB LED strip lights, and I have a few days for spring break, time to get hacking. Here’s a demo and explanation video:

I don’t mention it in the video, but the cool part of this project is how the different processes communicate with each other. Rather than interacting with the different processes through pipes, or something like stdin, I’ve decided to use a TCP websocket server:

StripPi High Level Diagram

Processes on the device send RGB values to the Strip Server via a TCP packet. This very very easy to implement, and almost all of the hard work is taken care of via the socketserver  module included in python3. This also allows for interactions with that main process (the StripPi Server process) to take place off of the Raspberry Pi as well. I plan on writing an Alexa integration for this project moving forward, and this should make that a lot easier.

The analog to digital conversion is handled by an MCP3008, exactly the same way as I did it here.

Thanks for reading, more soon.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Singer Parts Drawer Holder

I use these Akro-Mils 10144 D sets of drawers to keep my various electronics components organized. They’re cheap, reasonable quality, but most importantly inexpensive.


drawer

Something that I find myself doing a lot is transferring individual drawers around. For example, I have a specific drawer that holds short jumper wires for breadboards. Sometimes I bring this drawer up to campus for working in the lab. Same goes for my misc-resistor drawer. It’s much easier to move the drawer rather than re-packing it.

The problem is that these are open drawers! They don’t have lids, so what I’ll do is put it in a ziplog bag and throw it into my backpack. This is a bad solution, I have a 3D printer, time to get CADing.

I wanted the drawer to be able to lock in place, so it wouldn’t slide out of the holder while in transit, here is a video of the locking mechanism in action:

As I iterated on this design, it became clear that I could get away with a pretty thin wall thickness, and that extending the slot cut made it much much easier to flex the locking mechanism, so the grab point on the outer surface became unnecessary.

Annoyingly, I couldn’t figure out a good solution to be able to use this part without having to use supports.

Here is the Thingiverse Link

If you’re interested, I’m keeping a page of all of my prints. You can find it here.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Tiny Apartment Improvement Project – Wire Shelf Keyboard Holder

I recently purchased a Prusa i3 MK2 and it is glorious. The price was right, the assembly was straightforward and the print quality is probably better than I will ever need. After printing the requisite amount of dogs and other figurines, it’s time to start using this tool to improve my life.

Keyboard Shelf

I store a lot of my equipment on wire shelves. They’re cheap, easy to move around, and pretty strong. They can hold a lot of stuff, which means I keep a lot on them, and space, much like in the rest of my apartment, is limited. The server that is hosting this webpage lives on one of these shelves, and sometimes I have to manually work on it with a keyboard and monitor. It is a pain to have to dig out a keyboard, but it’s also not worth it to have a keyboard permanently on the shelf taking up space. That desire to maximize space is the motivation behind this project.

Here is the thingiverse page for this project with the parts, if you end up building or modifying it, let me know!

I’ve also added a page on this blog for holding more of my work with 3D printing, this will get fleshed out more as time goes on.

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.

Multiplexing Composite NTSC Video

This was one of those rare times where I had a hunch, followed it, and had a great result.

So for a project I’m working on for school, we have a robot with multiple composite video cameras onboard. We will be using those cameras seen on DIY drones or in simple security systems. We will be transmitting this video feed via a 5.8GHz video transmitter meant for a drone. We want the operator to be able to switch which feed they’re viewing at a given time, but we don’t want to have to use 3 transmitters and receivers. So to get around this, I thought we might just connect video feeds to a simple analog multiplexer I had laying around from a previous project and see if you could switch the feed that way. Turns out, you totally can. Here’s the eventual block diagram of this part of our project if you’re interested:

The following is the code running on the arduino. Remember, this isn’t doing anything special other than driving the mux:

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.