39 Results

[permalink]

Search
In my Arduino MQTT Examples, I kept things simple by only subscribing to a single topic. One of the strengths of MQTT is that a device can subscribe (or publish) to multiple topics. The broker will sort things out. Even though my first example only showed one, it is straight forward to get the Arduino PubSubClient library to subscribe to Multiple MQTT topics. The quick answer is that you need to look at the MQTT response to find out which topic sent the payload.

tl;dr version

If you’re looking for a quick answer, here’s the magic code we’ll add to the callback() function.

void callback(char* topic, byte* payload, unsigned int length) {
if (strcmp(topic,"pir1Status")==0)
  // whatever you want for this topic
}
Keep reading for a more detailed explanation of how to Subscribe to Multiple MQTT topics with Arduino’s PubSubClient. Obviously, this code will work on Arduino boards with a TCP/IP interface and, of course, the ESP8266 based boards.

You are probably familiar with Neil deGrasse Tyson. He is as brilliant as he is entertaining. That fact is why I was so excited when I saw his name pop-up on my queue for the Nerdist Podcast.

Nerdist Podcast

In the past, I suggested some electrical engineering podcasts. The Nerdist isn’t like those. Hosted by Chris Hardwick, each episode includes an interview. As the podcast’s name suggests, most of the guests have some roots in today’s nerd or geek culture. So while not an engineering podcast, there may be the occasional guest that interest you.

4 Great Things Neil deGrasse Tyson on Nerdist Said

This episode was the first time I took notes while listening to the Nerdist. Here are four quotes I captured, that make listening to the entire episode worthwhile.

This past weekend Arduino fans celebrated Arduino and Genuino Day 2016. In classrooms, maker spaces, and impromptu meet-ups around the world enginerds got together to learn and create with Arduino. At the Jacobs Institute for Design Innovation on Berkeley’s Campus, I first heard that Arduino Create had been launched.

In addition to hands-on learning workshops, there was a display of Arduino/Genuino projects by students. In the afternoon, three Arduino co-founders gave a short talk. David Mellis spoke on Machine Learning. Tom Igoe did his first talk on Technology and Humanities. Lastly, Massimo Banzi talked about IoT.

Arduino Day, Mellis, Igoe, Banzi
Arduino Day, Mellis, Igoe, Banzi

Massimo’s IoT discussion related to the earlier announcement that day of Arduino Create. This new platform has a web-based IDE, Arduino Project Hub, and Arduino IoT.

Excited about the announcements, I spent some time with the hackster.io powered Arduino Project Hub and the Arduino IoT.  Here’s my hands-on with Arduino Create.

One of the common questions related to using the millis() function in Arduino, is around timed events. After an event occurs, you want the code to wait for some time before doing the next step. But you don’t want to stop the program with delay().

[featured-image link=”https://www.baldengineer.com/use-millis-with-buttons-to-delay-events.html” single_newwindow=”false”]

In this example, we will use millis() to wait a few seconds after a pushbutton press to turn on an LED. Then a few seconds later, we will turn it off.  All without using delay().

Understanding millis()

The Arduino millis() function will let you accomplish this delayed action relatively easily. First, read through my multitasking with millis() tutorial and then look at some of my millis() cookbook examples I’ve already posted. Getting used to seeing this kind of code will make this line by line tutorial on timed events using millis() easier to follow.

The last time I looked at using an X-Carve for Printed Circuit Boards (PCBs), I created a demo board with EAGLE. Since then, I have learned more about using KiCad, the open source electronics CAD suite. While not a step-by-step tutorial, here is my rough KiCad to X-Carve PCB workflow. These are just the high-level steps, the tools necessary, and the settings I’ve discovered for each—so far.

Eventually, I will make this a more detailed KiCad to X-Carve PCB tutorial, so make sure you subscribe to my RSS feed for updates.

Here’s the Basic Steps:

  1. KiCad: Draw Board
  2. KiCad: Plot Gerbers
  3. KiCad: Generate Drills
  4. pcb2gcode: Generate G-code
  5. Text Editor: Clean Up G-code Files
  6. Camotics: Simulate G-code
  7. ChiliPeppr: Send G-code and control X-Carve
  8. X-Carve: Make the boards!