Ikigai

I ran across a post detailing the translation of the Japanese word 'Ikigai' -- loosely translating to "Reason for Being." I've noticed that some languages can capture a concept much more simply and meaningfully than English. Conversely English continues to invade other languages with our slang and technology.

There is a good article in the Toronto Star that details the concept. Looking at the various sectors of the chart aided me greatly in my introspection. Maybe it can help you too:

li-pasricha-pilot2.jpg

For me, I can clearly put mountain biking and skiing in the passion buckets. There are plenty of places I can put some of the Software/Firmware and Mechanical projects I work on. I think embedded electronics and control systems are the closest activities to Ikigai for me. It is interesting to me to think about activities and where they might fall so that I can help adjust the trajectory of my activities and where I spend time - maybe it will be helpful for you too.

 

Adam Markham
Adding Spindle Power Control to the Shapeoko

While finishing my basement a couple of years ago I bought an additional CNC mill - the Shapeoko3 XXL. I have worked on some pretty neat projects, most of which take a little bit of time. One of the things lacking is the ability to start/stop the router.

My shops a mess right now, I'm always in a state of cleaning/dirtying. But, the good news is, the experiment worked! Bottom line up front, I can now send a command to start/stop the Dewalt router through gcode.

What did it take to get here? I'll give a rundown of the parts list and what they are all doing

You'll also need some tools and supplies:

  • Philips Screwdriver
  • Wirestrippers
  • Soldering Iron
  • Flux
  • Solder
  • Wire
solder.png

Once the wires were soldered to the controller board, I attached the positive end to the IoT relay + and the negative to the IoT relay - and plugged the router into the 'normally off' plug. After that, the only modification to the gcode was to ensure that the following lines are in there (M3 S10000 and M5):

%
(TOOL/MILL,0.1,0.05,0.000,0)
(FILENAME: )
()
G21
G90
G0X0.000Y0.000Z5.000
(TOOL/MILL,12.7000,0,1.0000,0.0)
M6 T10
M3 S10000

....

G0Z5.000
G0Z5.000
G0Z5.000
M5
M30
(END)

Note that I put the M3 right after the tool change. Additionally, it was originally set to a spindle speed of 6100 or so, but since there is no spindle control, the S10000 sends the full +5V over the PWM to actuate the relay.

Adam Markham
Neighborhood Traffic

I currently live on a corner lot that is near the primary entrance to our neighborhood. As such, I see the occasional speeder and some odd patterns of traffic. Not being able to sit and count cars I sought out the next best thing - an automated traffic counter and speed camera. What is my intent? Simply to satiate curiosity and get some real data to validate/invalidate any forming opinions. Plus, it is a great excuse to buy some hardware and solve a problem.

This project started out with the selection of hardware. Probably a little backwards from normal, but I wanted to pick something cheap and have not had an opportunity to work with the Raspberry Pi 3 yet. I ended up buying the CanaKit from Amazon, since it came with the power supply and a case. The only thing lacking was a camera, which was also available on Amazon. Out the door this cost less than $100.

The first thing I did was get it booting. Unfortunately (or fortunately), the preprogrammed SD requires you to select which OS you want installed. This requires plugging in a keyboard, mouse, and monitor. That means you need something with an HDMI port and a spare USB keyboard and mouse lying around. If you don't, there is probably a way to provision it headlessly by flashing the µSD card. After it was booting, I gave it a static IP on my home router and was able to SSH in. It's certainly nothing pretty, but it is setup in my office like below.

IMG_20180218_080634.jpg

Before I set out on creating any new code I like to take a quick look to see what currently exists. Nobody has time to reinvent the wheel - and if I can leverage existing work I stand to potentially further the overall state of the art. In my search I ran across some Python code and installed that on the Pi3. I calibrated the system with my Jeep, averaging the pixels in each direction. The end result is the local collection of images of vehicles in transit.

speed-20180204-160459.jpg

The above image shows a detected vehicle and the approximate speed. Not being satisfied with having the images locally, I spun up an Amazon Web Services EC2 OwnCloud server to store the images and view them remotely. This presented its own set of problems. First, I installed a quick script to scp the files to the owncloud server. Next step was to have owncloud rescan the directories for files. The script running on the Pi3 remotely calls the rescan script after uploading. I set up a cron job to execute the script every 10 minutes.

Now that I've collected some data I can start on some data analytics. One of the more interesting data points I was looking for was checking when the traffic into and out of the neighborhood was heaviest. The speed-camera software outputs a CSV file with *some* of the information I was looking for. More on the planned improvements later. I used a simple COUNTIF function on the hours of the day to massage the data into buckets and generate the bar chart below.

chart.png

What information can be gleaned from the above? You can see the exodus from the neighborhood between 0700 and 1000. I found it interesting the large number that leave between 0900 and 1000 - a little bit of a late start. There is also a steady flow of traffic into and out of the neighborhood throughout the day.

Where to next?

  • Investigate thermal camera for more consistent imaging. I found a few FLIR options that can interface with the Pi3. The calibration will be interesting though, since I'm unsure of the temperature profile of cars and how it will register with OpenCV.
  • Find a better locale for the camera. The tree branches trigger the motion detection in high winds. Also, once that tree has leaves again, it will have no visibility.
  • Update script output to include time of day in standard format. Right now the CSV has a date string, hour string, and minute string. My preferred output is using the ISO 8601 standard.
  • Migrate away from owncloud. It seems that using a S3 bucket with a different frontend could be more cost effective.
  • Upload entries to this site. Instead of having to use an ec2 instance see about uploading the raw entry (not the picture) to this site in some manner for data analytics.
  • Calibrate the speed better. Some of the readings seem off. I think I need to move the camera further away from the street.
  • Separate R2L and L2R traffic. Analyze when people are coming and going.

That's all for now! More to come as I work on this project.

Adam Markham