Posted

So try this, go and restart your local MQTT broker. I'll wait

So how did that go?

If you like me based your MQTT clients code on the example code then you probably have some hung clients than need resetting.

So the Arduino/C examples has this code..

void loop()
{
    client.loop();
}

And the python examples have this..

while 1:
    client.loop()

Both simple to understand for starting out but if anything happens to you broker or there is a network problem etc your client is borked.

It fairly easy to fix though, we just don't assume we have a connection when we call client.loop and if we don't have a connection then lets connect.

Arduino/C

  if (client.connected ()){
     client.loop();
  }
  else {
    Serial.println("MQTT Broker Connection Down");
    if (client.connect("Shed_Temp","shed/will",0,0,"Shed Temp Fail")) {
       client.publish("Status","ShedTemp ReStart");
       Serial.println("MQTT Broker Connection Restated");
    }
    else {
      // Don't flood the broker with connections and it's already down so we don't need to worry about a delay disconnecting the client
      delay(15*1000);
      Serial.println("MQTT Connection Delay");
    }
  }

Python

def connectToBroker():
    client.will_set('jarvis/will/local', payload="Jarvis Local Fail", qos=0)
    try:
        if not client.connect("127.0.0.1"):
            client.subscribe("temperature/#", 0)
    except socket.error, (value,message):
        print "Could not open socket: " + message
        time.sleep(5)

while 1:
    try:
        if client.loop():
            print("Broker Connection Error")
            connectToBroker()
    except socket.error, (value,message):
        print "Could not open socket: " + message

While updating my clients code I've also taken the opportunity to setup last will and testament so i get a MQTT message when the clients disconnect. I intend to hook this up to MQTT Warn so I get notifications when MQTT clients disconnect unexpectedly.

Author
Categories ,

Posted

I had a huge day yesterday at Sydney's fist Mini Maker Fair.

I had a stall showing off some of my previous work as well as demonstrating a couple of products I have in development. There was lots of interest in my "Networked Buttons for Sparkcore" product that still needs a name as well as Wink the Smatphone control for professional video cameras.

There isn't a lot of information on these projects on the website, more information will be posted in the coming days. If you keen to hear about progress on the projects please sign up to the mailing list.

Fill out my online form.

Author

Posted

So my second go with my reflow oven was a bit of a fail. So time for some more learning from the internet and testing.

Things I now know.

  • The T962 oven uses infrared heating element, thus black IC’s heat up faster than other components and white things like the WS2812’s I was trying to reflow will reflect heat and need a bit of a longer time to reflow properly.
  • I rate SparkFun Rejuvenating Solder Paste with Tim Holmberg
  • Adafruit also has a great series of pages on SMT Manufacture
  • Adafruit recommend these SMT Stencil Wipes but so far baby wipes seem like a fairly good alternative.
  • The sparkfun Solder Paste Stenciling tutorial is well written, funny and made me think a bit more about the saftey aspect. Wear gloves and read the material safety data sheet’s

I've been getting great results cutting my own stencils, I'll save the details for another post soon.

Author
Categories

Posted

So I’m making that big move from building circuits with mainly though hole parts and breakout boards to working with surface mount parts.

I’ve read a lot of articles on surface mount prototyping and I have a lot of respect for the hand soldering ninjas that can work with crazy small SMD parts. But I've built up a bit of an opinion about working with surface mount technology.

Surface mount technology is designed to be assembled using pick ‘n place machines and soldered using reflow ovens. So the best way to prototype with surface mount parts is to make a workflow as close to the manufacturing process as possible. After all its what the parts have been designed for.

I’ve always felt that the key thing in any job is having the right tools. Sure you can do jobs with other tools but it’s always more effort, usually frustrating and often a poorer result.

So the pick and place thing I’ll talk about in a while this update is about reflow ovens.

So I went for the cheep Chinese T-962 reflow oven. I’ve read good and bad things about the units, seems mostly luck of the draw. One thing I did do before running it the first time was to rip it apart and replace the masking tape with Kapton tape following the advice from this instructable.

Now it looks much better more “Apollo Space mission” than before.

I’m aware of other hacks on these ovens and controller upgrades that cost as much as the ovens. I’m not planning on any further changes other than some kind of fume extraction unless I have problems with reflowing larger boards.

Author
Categories

Posted

So at the beginning of the year I was planing on documenting the projects I did in 2012, start posting on my website regularly and start hoping to generate a bit more traffic. The aim was to start making some boards and kits and staring a little Open Source Hardware electronics store. It’s not like I want to be the next adafruit, seed or SparkFun. But it would be nice to be the next Evil Mad Scientist, Dangerous Prototypes, Arachnid Labs or countless others in the community.

So now it’s September, What happened?

I got distracted. Basically I had a great product idea. Everything else stopped and I got very focused on the product for several months. I’m still working on it but not with the kind of focus I had in the early months. I’m not quite ready to put the idea out on the internet quite yet but I will say it’s a Bluetooth Low Energy (BLE) product with an iOS and in future Android app. I’m planing on doing the first batch of the product as a Kickstarter.

I know from my research that these projects always take far longer than you think. The thing is though you don’t really understand or believe that until it happens to you. So development on the product idea continues but I understand it’s going to take a while so other smaller projects are getting some attention.

One of the outcomes of the product project is that I’m tooling up the workshop for making surface mount boards, this is something i’ve been wanting to do for quite a while. I also keep having new ideas for boards and kits. So I’m hoping I’ll be able to get back to my original plan of starting up a little electronics shop and also having the product project idea moving along at the same time.

So next up some posts on the new gear in the workshop.

Author

← Older Newer →