Set Mac Volume to a Specific Percentage with an Alfred Workflow

The Touch Bar on the MacBook is a pain in the ass. I’ve been getting sick of fighting with it to adjust volume and wanted an alternative to using the icon in the Mac OS menu bar. I already had some AppleScript code I use to reset volume to start my work day, so I ran with it to make a simple Alfred Workflow.

I didn’t realize how awesome this workflow would be. I’m using it all the time, even on my other Mac, which has the keyboard volume control buttons.

mac-vol-alfred-workflow-screenshot.png

Get it on GitHub.

Repurpose

component-video-switchAfter watching recent Adafruit videos (12, & 3) about IR and getting a neat new microcontroller which has a built-in IR transmitter, it looked fun to hack around with. I don’t have an IR receiver though. Then I remembered this old component video switch was in a storage closet. I tore it apart and easily got out the IR receiver. While I was destroying the device I figured I might as well take a bunch of parts that may be useful. If nothing else it was good practice desoldering.

The big PCB with a lot going on is already gone with the trash. The two small PCBs with buttons and LEDs (a triple set and a single) are cool and will be fun to work with since they’re already wired up. Would be neat to use these in an actual project some day.

img_8931The other components I kept are:

  • IR 4 button remote
  • L7805 voltage regulator
  • PIC16C505 CMOS microcontroller
  • HD74HC126P quad buss buffer

  • 2x CD4052BE analog multiplexer/demultiplexer
  • HA17358A dual operational amplifier
  • 78L09L voltage regulator
  • A1515S PNP transistor
  • 71M4 IR receiver sensor

Of course, I can’t find a datasheet for the one part I want to use. IR is pretty standard, so I’m hoping they didn’t go rogue when developing this device. I’ll post more once I get a chance to experiment.

Several months ago I would have had no idea what any of this stuff was, let alone how it worked. I still don’t know what several of those ICs do, but at least I’m able to look at the traces on the PCBs and follow connections to get a general idea of how everything works.

Never stop learning!

Combining 74HC74 & 555 Integrated Circuits

After working with some basic 74HC74 and 555 circuits, it was time to get fancy. I replaced one of the button triggers from my 74HC74 circuit with a 555 timer delay.

74HC74-555-button-wiring.png

Then I replaced the other button with a 555 timer delay as well.

555-74HC74-555-wiring.png

What do you think happens if I swap out the 22 μF capacitors for 4.7 μF? Remember the capacitor charge time formula from the 555 post? Multiply the capacitance (farads) by the resistance (ohms) to get the time. I’m still using the same 100 K ohm resistors.

t = RC

100000 * 0.0000047 = 0.47

So the delay decreases from 2.2 seconds to 0.47.

There is really no point in the 74HC74 here. You can connect two 555s to each other for a similar result. The video shows a double 555 circuit with 3 different timings, where I swap the capacitors from 22 μF to 4.7 μF and then 1 μF (delay of 0.1 second).

double-555-wiring.png

Are there any other circuits I should try with the 74HC74 and/or 555?

grasshopper

I bought the new Raspberry Pi Zero W along with the official Raspberry Pi Zero case. It’s really nice not having to worry about a wireless adapter. The addition brings my Pi family up to 7, which of course means it’s time for the letter G. Not a lot of pies starting with G. I ended up going with grasshopper pie, which is based off the popular drink and happens to be the first drink I ever made with my Mom. We always used to make the ice cream variation during the holidays, which is effectively a mint milkshake.

2017 CrossFit Games Open Results

As previously mentioned, due to tweaking my back, I wasn’t able to do the 5th and final workout of the Open this year. I’m feeling good to go now and didn’t want to delay my attempt on 17.5 any longer, so I did it in my garage yesterday.

When the workout was announced I knew everyone would be tricked into thinking they had to do the thrusters unbroken. It’s the beauty of the workout design. Change it from 9 to 10 reps and people would have thought different about it. I tried to convince people breaking up the thrusters would be beneficial, but nobody believed me. I certainly didn’t plan to do 10 sets of 9 unbroken thrusters.

I split up the first 9 sets into 5 reps, a strict 3 count to rest, and a set of 4 reps. I did the 10th round unbroken. It worked out great and allowed me keep a steady pace through the entire workout. I geek out a bit on split times over on my workout blog if you’re interested in that kind of thing. Finished the workout in 13:28.

While not official results, I calculated where I would have ranked this year if I had been able to submit this score. Overall through the 5 weeks I would have had 139,975 points in the Open division, ranking me 20,616 / 201,951 (10.2%) and 18,825 points in the new Masters 35-39 division for 2,455 / 38,106 (6.4%). My best year yet!

CrossFit Games Open Ranking History

  • 2012: 16,395 / 20,857 (78.6%)
  • 2013: 9,251 / 43,479 (21.3%)
  • 2014: 13,721 / 66,904 (20.5%)
  • 2015: 13187 / 118,237 (11.2%)
  • 2016: 19,060 / 139,037 (13.7%)
  • 2017: 20,616 / 201,951 (10.2%)

I don’t know why, but a bunch of these previous year numbers are substantially different in terms of participation (lower) that I’ve written about before. According to the current CrossFit Games Leaderboards it’s the data I come up with though. I always base it off the number of men who completed at least one of the workouts.

Back Update

On Sunday March 24th, I tweaked my back. I’ve been having some issues for the last year or so, but never like this. Usually I feel it happen and can continue training in a limited capacity during the same workout session. I’ll back off weights for a few days, but within a week I’m back to normal. This time was different. It literally took minutes to get out of bed on Monday morning and walking was a struggle.

When I felt worse on Tuesday morning I made an appointment to see my chiropractor. It helped a little, but not much. After getting home and sitting to work for hours, it was not easy standing back up. When I woke up worse yet on Wednesday I was getting worried. Did I have a ticking time bomb in my low back that could be set off any second? I called my chiro and he talked me down, explaining it was a good sign I wasn’t getting any numbness or tingling up or down from the area. I was so uncomfortable sitting or standing I took the day off work and spent it laying on the living room floor watching TV. Getting up off the floor wasn’t pleasant but at least I was feeling ok when I was down there.

I went back to the chiro on Thursday and he mentioned moving around while sitting on an exercise ball may help, so I actually used one as my desk chair the rest of the day and on Friday too. Finally on Friday evening I started to feel some improvement. Waking up Saturday was still a struggle and I gave up on socks after failing to put them on for several minutes. Once I was up and moving around the house, things loosened up and I saw more improvements through the day. When I woke up on Sunday I was able to get out of bed, shower, and put clothes on mostly normal.

Now I was on to week two and I felt better each day. I saw the chiro two more times that week. I was still leaning to one side and moving gingerly until probably Wednesday. I had been able to get on the Airdyne for some exercise through those first 10 days and it was actually when I felt the best. I slowly started adding in more exercise movements like air squats, box step-ups, and lunges.

On Monday, which was the beginning of the 3rd week, I squatted some decent weight (over 70% of my max) with no pain. I saw the chiro one last time on Tuesday. On Wednesday I did a workout with quite a bit of deadlift volume. Didn’t need to restrict any movements at this point and hadn’t felt any pain in several days.

I drove an hour down to Holly, MI on Thursday to see a PT who knows CrossFit. One of my friends recommended him and I liked the idea of seeing a PT who understood the movements. I figured I’d feel more comfortable with any plan he came up with compared to going to see a PT in an office.

During my evaluation we talked through the history of my back tweaks. Then he testing some ranges of motion and watched me do some squats, twists, bends, etc in his “office.” Took me into the gym and watched me squat and deadlift moderate loads. Then he had me do some unilateral movements with a kettlebell. Finally back to deadlifts but from a deficit. We were talking through everything the whole time.

It’s not a mobility issue for me, other than some minor hamstring restrictions at end range. He gave me a bracing and stability tip to get more neutral in my setup; I have had a slight tendency to arch more than needed. He recommended movements to strengthen and stretch my hamstrings under load, showed me a psoas release technique, and gave me some unilateral work to address imbalances I have in my low back muscles.

Turns out I was on the right track with some of the things I’ve done at different times to address this problem. Unfortunately I was never sure and didn’t stick to anything long enough to make a difference. So far I’m really liking the unilateral stuff, which in general is a weakness of most CrossFit programming. We love the barbell, but it can hide a lot of imbalances. I’m excited to see how things progress over the next couple of months.

Using a 555 Integrated Circuit

555-pins

555 Pins

I posted about the 74HC74 flip-flop on Saturday. For the same project I’m going to use that IC for, I’ll probably use a 555 timer. It’s often referred to as one of the most useful ICs you can get. I’ve never used the 555 either, so I wired up some simple demos using it. In order to show two common timing uses, I’ve created similar circuits each triggered by the same power source and button.

The circuit on the left shows a delay off timer and the one on the right shows a delay on timer. Notice when power is connected (or the button is used as a reset) that the red LED turns on right away and turns off after a few seconds. Just the opposite, the white LED is off when the timer is reset and turns on after a few seconds.

The length of the delays is determined by the capacitor and resistor used with the 555. I’m using an Adafruit Feather to provide 3.3 volts to the circuits with a 22 μF capacitor and 100 K ohm resistor. Using the capacitor charge time formula to multiply the capacitance (farads) by the resistance (ohms), it’s easy to get the time.

t = RC

t = 100000 * 0.000022

Comes out to 2.2 seconds. To change the time delay all you have to do is use a different capacitor and/or resistor.

Here is a simplified wiring setup because it’s hard to see how everything is connected in the video.

555-wiring.png

Also check out Combining 74HC74 & 555 Integrated Circuits.

Remembering Arnold Palmer

Sunday at the Masters.

I walked my first 9 holes of the year this morning with Alex, hitting some good shots. When I got home I brewed an iced tea and lemonade, also known as an Arnold Palmer. Now I’m going to relax all day. First up is watching the special “Jim Nantz Remembers Augusta: Arnold Palmer – His Last Visit to the Masters.” Then I’m going to watch the tournament.

arnold-palmer-masters.jpg

Photo by: Sam Greenwood/Augusta National