Posts

Side Quest - Visualizing Analog Values with Processing

Image
 As I started on the next sensor, I realized that displaying analog values as scrolling numbers in a serial console was going to be boring. I started down the path of using Tkinter in Python, but decided that learning a whole new GUI framework was more than I wanted for this project. I may revisit that in the future, because this is something I definitely want to add to my knowledge base for future projects. Instead, I decided to go with something in the Arduino Cinematic Universe and see what Processing could do. Using an example I found online, I made some tweaks to work with my plans better. This program draws a gray circle in the middle of a window with a diameter equal to half the window. It listens on a serial port at 115,200 baud for either a single number on a line or a pair of numbers separated by a comma on a line. If there is just one value, the circle scales up or down by that value. If there are two values, it is drawn as an ellipse with each radius based on the two v...

First Sensor – KY-023 Joystick

Image
This little joystick is similar to the ones on many modern game controllers. It slides smoothly in X and Y and clicks a button when pressed. The X and Y axes are connected to potentiometers and form a voltage divider between 0v and 5v with the center rest point theoretically being at the 2.5v point. Reading the joysticks is as simple as polling two analog inputs. The switch connects to ground when depressed, so use a digital input with the Arduino’s built in pullup resistor. Below is the code that I ended up with for reading this sensor. It’s a very basic program that sets up the appropriate pins and then loops forever reading the values from all three pins and displays them via the serial port. I’ll definitely revisit this joystick in some of the future projects as a simple input device that allows for two different analog values and a digital input for triggering. Pros: Simple interface – power, ground, 2x analog, 1x digital Feels smooth and clicks nicely Cons: The values return hit ...

New Project - Every Sensor in the 45-in-1 Sensor Kit

Ages ago, I got this nifty 45-in-1 sensor kit from Alliexpress. The price was right and it seemed like something fun to play around with. Of course, it has languished in the pile of "stuff I'll get to someday" and I really haven't done much with it. Oh, sure, I opened it up and marveled at all the cool things that it had and dreamed of the potential each little board could provide. "Some day" I told myself. Well, that some day is starting now! I've resolved to hook up each sensor to an Arduino Uno and write some code to make each one do something. Maybe nothing exciting, certainly nothing novel. I'm sure I'm not the first person to do this with a kit like this. In fact, I'm so sure I'm not even going to research that claim. I want to go into this without preconceived notions of what this project will end up being. The goal: write a project for each sensor. Stretch goal: do something cool with some of the sensors. Stretchier goal: combine...