Create A Discord Webhook With Python For Your Bot

Discord is an IRC-like chat platform that all the young cool kids are hanging out on. Originally intended as a way to communicate during online games, Discord has grown to the point that there are servers out there for nearly any topic imaginable. One of the reasons for this phenomenal growth is how easy it is to create and moderate your own Discord server: just hit the “+” icon on the website or in the mobile application, and away you go.

As a long-time IRC guy, I was initially unimpressed with Discord. It seemed like the same kind of stuff we’ve had for decades, but with an admittedly slick UI. After having used it for a few months now and joining servers dedicated to everything from gaming to rocket science, I can’t say that my initial impression of Discord is inaccurate: it’s definitely just a modern IRC. But I’ve also come to the realization that I’m OK with that.

But this isn’t a review of Discord or an invitation to join the server I’ve setup for my Battlefield platoon. In this article we’re going to look at how easy it is to create a simple “bot” that you can plug into a Discord server and do useful work with. Since anyone can create a persistent Discord server for free, it’s an interesting platform to use for IoT monitoring and logging by simply sending messages into the server.

Continue reading “Create A Discord Webhook With Python For Your Bot”

OpenSCAD: Tieing It Together With Hull()

What’s your favorite OpenSCAD command? Perhaps it’s intersection() or difference()? Or are you a polygon() and extrude() modeler? For me, the most useful, and maybe most often overlooked, function is hull(). Hull() does just what it says on the can — creates a convex hull around the objects that are passed to it as children — but that turns out to be invaluable.

Hull() solves a number of newbie problems: making things round and connecting things together. And with a little ingenuity, hull() can provide a nearly complete modelling strategy all on its own. If you use OpenSCAD and your creations end up with hard edges, or you spend too much time figuring out angles, or if you just want to experience another way to get the job done, read on!

Continue reading “OpenSCAD: Tieing It Together With Hull()”

Ball and socket helping hands

Printed It: Do More With Lockable Ball And Socket Helping Hands

In one hand you hold the soldering iron, in the other the solder, and in two more hands the parts you’re trying to solder together. Clearly this is a case where helping hands could be useful.

Magnifying glass with helping hands
Magnifying glass with helping hands

Luckily helping hands are easy to make, coolant hoses will do the job at under $10. Attach alligator clips to one end, mount them on some sort of base, and you’re done. Alternatively, you can steal the legs from an “octopus” tripod normally used for cell phones. So why would you 3D print them?

One reason is to take advantage of standardized, open source creativity. Anyone can share a model of their design for all to use as is, or to modify for their needs. A case in point is the ball and socket model which I downloaded for a helping hand. I then drew up and printed a magnifying glass holder with a matching socket, made a variation of the ball and socket joint, and came up with a magnetic holder with matching ball. Let’s takea  look at what worked well and what didn’t.

Continue reading “Printed It: Do More With Lockable Ball And Socket Helping Hands”

3D Printering: Printing Sticks For A PLA Hot Glue Gun

When is a hot glue stick not a hot glue stick? When it’s PLA, of course! A glue gun that dispenses molten PLA instead of hot glue turned out to be a handy tool for joining 3D-printed objects together, once I had figured out how to print my own “glue” sticks out of PLA. The result is a bit like a plus-sized 3D-printing pen, but much simpler and capable of much heavier extrusion. But it wasn’t quite as simple as shoving scrap PLA into a hot glue gun and mashing the trigger; a few glitches needed to be ironed out.

Why Use a Glue Gun for PLA?

Some solutions come from no more than looking at two dissimilar things while in the right mindset, and realizing they can be mashed together. In this case I had recently segmented a large, hollow, 3D model into smaller 3D-printer-sized pieces and printed them all out, but found myself with a problem. I now had a large number of curved, thin-walled pieces that needed to be connected flush with one another. These were essentially butt joints on all sides — the weakest kind of joint — offering very little surface for gluing. On top of it all, the curved surfaces meant clamping was impractical, and any movement of the pieces while gluing would result in other pieces not lining up.

An advantage was that only the outside of my hollow model was a presentation surface; the inside could be ugly. A hot glue gun is worth considering for a job like this. The idea would be to hold two pieces with the presentation sides lined up properly with each other, then anchor the seams together by applying melted glue on the inside (non-presentation) side of the joint. Let the hot glue cool and harden, and repeat. It’s a workable process, but I felt that hot glue just wasn’t the right thing to use in this case. Hot glue can be slow to cool completely, and will always have a bit of flexibility to it. I wanted to work fast, and I wanted the joints to be hard and stiff. What I really wanted was melted PLA instead of glue, but I had no way to do it. Friction welding the 3D-printed pieces was a possibility but I doubted how maneuverable my rotary tool would be in awkward orientations. I was considering ordering a 3D-printing pen to use as a small PLA spot welder when I laid eyes on my cheap desktop glue gun.

Continue reading “3D Printering: Printing Sticks For A PLA Hot Glue Gun”

Printed It: Rubber Band PCB Vise

If you’ve ever worked on a small PCB, you know how much of a hassle it can be to hold on to the thing. It’s almost as if they weren’t designed to be held in the grubby mitts of a human. As designs have become miniaturized over time, PCBs are often so fragile and festooned with components that tossing them into the alligator clips of the classic soldering “third hand” can damage them. The proper tool for this job is a dedicated PCB vise, which is like a normal bench vise except it doesn’t crank down very hard and usually has plastic pads on the jaws to protect the board.

Only problem with a PCB vise is, like many cool tools and gadgets out there, not everybody owns one. Unless you’re doing regular PCB fabrication, you might not take the plunge and buy one either. So what’s a hacker on a budget to do when they’ve got fiddly little PCBs that need attention?

Luckily for us, we live in a world where you can press a button and have a magical robot on your desktop build things for you. Online model repositories like Thingiverse and YouMagine are full of designs for printable PCB vises, all you have to do is pick one. After looking through a number of them I eventually decided on a model designed by [Delph27] on Thingiverse, which I think has a couple of compelling features and more than deserves the few meters of filament it will take to add to your bench.

Of course the best part of all of this is that you can customize and improve the designs you download, which is what I’m about to do with this PCB vise!

Continue reading “Printed It: Rubber Band PCB Vise”

Custom Alexa Skill In A Few Minutes Using Glitch

As hackers, we like to think of ourselves as a logical bunch. But the truth is, we are as subject to fads as the general public. There was a time when the cool projects swapped green LEDs out for blue ones or added WiFi connectivity where nobody else had it. Now all the rage is to connect your project to a personal assistant. The problem is, this requires software. Software that lives on a publicly accessible network somewhere, and who wants to deal with that when you’re just playing with custom Alexa skills for the first time?

If you have a computer that faces the Internet, that’s fine. If you don’t, you can borrow one of Amazon’s, but then you need to understand their infrastructure which is a job all by itself. However, there is a very simple way to jump start an Alexa skill. I got one up and running in virtually no time using a website called Glitch. Glitch is a little bit of everything. It is a web hosting service, a programming IDE for Node.js, a code repository, and a few other things. The site is from the company that brought us Trello and helped to start Stack Overflow.

Glitch isn’t about making Alexa skills. It is about creating web applications and services easily. However, that’s about 90% of the work involved in making an Alexa skill. You’ll need an account on Glitch and an Amazon developer’s account. Both are free, at least for what we want to accomplish. Glitch has some templates for Google Home, as well. I have both but decided to focus on Alexa, for no particular reason.

Continue reading “Custom Alexa Skill In A Few Minutes Using Glitch”

Software Design Patterns For Real Hardware

Here on Hackaday, we’re generally designers of hacks that live in the real world. Nevertheless, I’m convinced that some of the most interesting feats are at the mercy of what’s possible in software, not hardware. Without the right software, no 3D printer could print and no quadcopter could fly. The source code that drives these machines may take months of refinement to flesh out their structure. In a nutshell, these software packages are complicated, and they don’t happen overnight.

So how do they happen; better yet: how could we make that happen? How do we write software that’s flexible enough to coexist peacefully on all sorts of hardware variations?

What separates the big open-source software projects like ROS, LinuxCNC, and Multiwii from the occastional hackathon code are the underlying principles that govern how they’re written. In object-oriented programming, these principles are called design patterns. In the next couple posts, I’m going to crack the lid on a few of these. What’s more, I’ll package them into real-world examples so that we can see these patterns interact with real hardware. The next time you pop open the source code for a big open source hardware project, I hope you can tease out some of these patterns in the code. Better yet, I hope you carry these patterns into your next robot and machine project. Let’s get started.

For readability, all of the examples run in Python3. The snippets below are truncated for brevity, but the real examples in the repository will work if you’ve got a similar hardware setup.

Continue reading “Software Design Patterns For Real Hardware”