Making Tasmota lights turn on urgently

I’m a huge user of Home Assistant and Tasmota open source firmware for ESP8266 based devices. It has allowed me to set up quite a nice smart home setup including light bulbs without using external services.

If you’re like me though, and sometimes just urgently need a light to turn on and for some reason the controller isn’t responding, or something has broken in your fiddling, then this rule is quite handy.

Using the powerful Tasmota Rules framework I’ve set up a rule to make certain lights turn on if I flick the original power switch off then on.

Simply go to your Tasmota console for the light you’d like to add this rule and put:

Rule1 ON Power1#Boot DO backlog delay 1; power on; ct 430; dimmer 100; ENDON

This will on boot up turn on the light to full brightness with a pretty warm colour temperature. Of course this is for my lights that have colour temperature, so you may need to adjust for your lights as needed.

I can think of times where maybe there’s a fire upstairs where the HA Raspberry Pi is set up and the controller is offline. You need light and right away. Or maybe your room controller for some reason has gone offline, or your wifi access point as died.

I’ll update this if I find a better method, as I’m worried it needs some more conditions (ie I don’t want it turning on with a system restart etc) but it’s good for now!

A better way to configure Cura to slice objects for your Makerbot Replicator 2 3D printer

I’ve posted previously about using Makerbot Replicator 2 3D printers with Cura, which involved hacking at the X3GWriter plugin, but was frankly a little hacky, and starts to cause problems when you update etc.

With more time on my hands now I’ve had a closer look and spoken to the author of the X3GWriter plugin. It turns out that the printer definition in Cura passes metadata to the plugins you use, and that his X3GWriter plugin was watching for the “machine_x3g_variant” value. When we modify the standard printer definition for Replicator 1 that comes with Cura, it still passes “r1” to the X3Gwriter plugin, which makes it take on values for the Replicator 1 which results of course in incorrect print scaling. For a replicator 2 we actually want “r2”. Makes sense.

So if you’ve been trying to use Cura on your Replicator 2, and getting things that are the wrong size, you’ll need to create or modify your profile for your printer.

Ideally, Cura would come with a Replicator 2 profile, which I’ll put time in to submit to the maintainers via github once I can understand how their provided profiles work, but for now here’s my little how to:

I’m using Cura 4.6 for my example, and this is specifically for the Replicator 2 – you may need to modify some things to make the 2X work

I also assume that you’ve installed the X3GWriter plugin already in Cura’s “marketplace”

1. Open Cura, and add a new printer. Click on non-networked printer, and select “Makerbot Replicator”

2. Once you’ve added this printer, rename the printer to something like “Makerbot Replicator 2” (doesn’t matter what, it won’t affect anything), and go to “machine settings” for this new printer.

3. Make the Gcode flavour “makerbot”, enable origin at center, disable heated bed, select build plate rectangular, and make the dimensions the following:

   x width = 225mm

   y depth = 145mm

   z height = 150mm

Here are my printer settings:

1127212819_Screenshotfrom2020-05-2519-03-25.thumb.png.3450bc6c7570b0616f83b1ca006950ec.png

4. We’ll also check settings for “extruder 1”. The standard nozzle size is 0.4mm, and the compatible material diameter is 1.75mm.
Here’s my extruder settings:

1191352320_Screenshotfrom2020-05-2519-06-24.png.de9bf5f4485a2601947017bbb194592c.png

5. Add the custom GCode to the printer settings. This is necessary as for some reason by default heated bed info is sent, which makes the printer stop straight away. You can look up what this means and tweak it as needed (maybe you want the bed to drop lower at the end etc).

Contents of my start Gcode:

; -- start of START GCODE –
M73 P0 (enable build progress)
;M103 (disable RPM)
;G21 (set units to mm)
M92 X88.8 Y88.8 Z400 E101 ; sets steps per mm for replicator
G90 (set positioning to absolute)
(**** begin homing ****)
G162 X Y F4000 (home XY axes maximum)
G161 Z F3500 (home Z axis minimum)
G92 Z-5 (set Z to -5)
G1 Z0.0 (move Z to "0")
G161 Z F100 (home Z axis minimum)
M132 X Y Z A B (Recall stored home offsets for XYZAB axis)
(**** end homing ****)
G92 X147 Y66 Z5
G1 X105 Y-60 Z10 F4000.0 (move to waiting position)
G130 X0 Y0 A0 B0 (Set Stepper motor Vref to lower value while heating)
G130 X127 Y127 A127 B127 (Set Stepper motor Vref to defaults)
G0 X105 Y-60 (Position Nozzle)
G0 Z0.6     (Position Height)
; -- end of START GCODE –

Contents of my end GCode:

; -- start of END GCODE –
G92 Z0
G1 Z10 F400
M18
M104 S0 T0
M73 P100 (end  build progress)
G162 X Y F3000
M18
; -- end of END GCODE –

Here’s what it should now look like in your printer settings (the gcode settings of course are longer than the box, so they scroll, don’t copy directly from this image for them):

228029716_Screenshotfrom2020-05-2519-09-13.thumb.png.306b9ed405e5c5ee818e7b0be88da208.png

So we now have the printer defined, but it’s missing the important piece of the puzzle which is the metadata to pass along to the X3GWriter plugin so that we get an X3G file suited for the Replicator 2.

6. Let’s manually edit the printer definition file. Close Cura before continuing. I’m using Ubuntu Linux, so my printer definition file is in:
/home/username/.local/share/cura/4.6/machine_instances/MakerbotReplicator2.global.cfg

I use nano, but any text editor (even gnome’s gedit) will be fine to edit this file.

If you’re in windows, try a system-wide search for the location (sorry I don’t know where it lives in Windows)

We are looking for the heading “[metadata]”, and anywhere under this heading block we’re going to put “machine_x3g_variant = r2”. For example, here’s what mine looks like (some details will be different for yours):

[general]
version = 4
name = MakerBotReplicator2
id = MakerBotReplicator2

[metadata]
setting_version = 13
machine_x3g_variant = r2
type = machine
group_id = 993612c3-052e-42e2-bb6b-c5c6b2617912

[containers]
0 = MakerBotReplicator #2_user
1 = empty_quality_changes
2 = empty_intent
3 = normal
4 = empty_material
5 = empty_variant
6 = MakerBotReplicator #2_settings #2
7 = makerbotreplicator

Notice where “machine_x3g_variant = r2” is?

Save this file where it is, and reopen Cura.

That should be it. You’ll be able to directly choose your printer in the normal way, choose your settings and object, and export. If you find it doesn’t successfully create a file, there’s something up with your config, so double check any syntax problems etc.

You can also check the output of Cura’s errors in (again I’m in Linux):

/home/username/.local/share/cura/stderr.log

So if you tweak Gcode and tinker with those bits and pieces you can see if X3GWriter is unhappy about any of it.

Happy printing!

Delete your Facebook

As one half of an artist duo that makes work that is quite critical of the way in which social media is distorting our lives, I felt like a hypocrite to continue to have an account at Facebook.

Somehow along the way, I was coerced into joining (somewhere around 2008) to see what all the fuss is about. Looking back at my posts, I can see where I was being cautious, and a definite point at which I became addicted.

Suddenly I felt it was ok to share even the most bland of things or have a good old rant about something, but for who?

Why do we all feed our most personal of information into this private corporation’s database? We would never be ok about our government knowing this much about our personal lives!

On top of this, each one of us with an account in the western world is worth approximately $34 a year in advertising revenue to this multi-billion dollar corporation. Advertising and tracking that follows us around as we browse the web elsewhere. Doesn’t that feel invasive?

Today I stop feeding this machine. It’s time to take back what is ours, and our personal information is the most important thing we have. Consider whether you want to continue down this rabbit hole and join a growing number of people deleting their Facebook. Let’s stop hashtagging and start to get back into real contact with the people we care for.

Use Facebook to promote things to friends and followers? Consider a mailing list. Use it to keep in touch with friends and family? Use one of the many many messaging apps around that don’t track you. You enjoy the personal blogging? Start a WordPress blog. Everything can be done without this tool, it’s just become easier for some reason to use it.

If you need help for alternatives to use in future, get in touch, I’m happy to assist.

Advice to young creatives from a mid-career artist

As part of artist duo “Cake Industries”, we’ve been asked to give many talks over the years, and those talks generally focus on what we’ve done, what we’re currently working on, and possible future paths we might take.

What we’ve never really done though is try to give advice to young people trying to figure out their place in the world, and especially as creatives, how to be what we want to be as artists, as we felt like we were still trying to figure it out ourselves.

As I rapidly approach 40, it seems weird to think that I’m probably half-way through my career, though I still feel 25 inside and just starting out. I feel like at this point in my career, though, that I’d like to give some advice to young people feeling like they’re not sure where to go in a few pieces of advice. These are based on some hard lessons I’ve learned as an artist surviving in the world.

Nobody is an authority
Despite what many in the arts may believe, nobody is a complete authority. This includes me and my advice here. There may be a director or a curator, or even another artist who tells you how to get ahead in your career. Mostly they are wrong, and their advice either is specific to an artform, period in time, or a particular situation. If you feel strongly about something, then do it. You may forge a new path, or find others along the way that think the same way.

Don’t wait
There is lots of advice out there from well-meaning people that you just have to wait, or that your generation will have their time, or that you should just wait until X. Don’t wait. Time really can fly and before you know it another decade has dawned. If you feel the passion to do something, then do it no matter what. Ignore funding deadlines, ignore local council opportunities. If they don’t fit, or they require waiting for significant periods of time, then find another way to do what you want to.

Be all in, or don’t bother
This could be controversial, but the longer you delay really pushing forward with your passion, the further out of reach it will be. That full time job you landed “until things pick up” will possibly divert your life away from what you want to do. That permanent support role you have could make it seem like you don’t have your own ideas or interests. Of course we all have to find ways to make ends meet (I’ve worked many casual and part time positions over the years), but keep these engagements short and controlled so that you don’t forget what you’re doing them for.

There’s no such thing as “making it”
It’s almost as if we all believe that one day you’ll get out of bed and a sign will be there letting you know you’ve “made it”. Making it is a strange idea, as we never truly finish or reach a point where we can rest. We are all going to be continuously trying to make the next idea happen, get to the next place, try a little harder. While you’re wondering about how to survive next year, people younger than you are looking up to you and thinking that your life must be so easy now. Just keep going.

Life is both short and long
Sometimes it seems like forever, that the slog to create and survive goes on and on. But suddenly you realise something you made was 10 years ago. Every single one of us could also die suddenly at any time. Pretend as if you only have 5 years left to live and pour your energy and focus into what you love. The idea that you could do something when you reach your 60s may never happen, so just try now.

There is no single path
No matter who you are or what you make, there is no single path in your career or life. Even if you’re told as much, don’t believe the hype. With over 8 Billion people on the planet, there are so many ways to find your scene, your place, your focus that nobody can definitively tell you what step to take next.

You may disagree with some or all of the advice above, and that’s fine, but my hope is that it may inspire some young creatives to push aside the rubbish in their life, and follow their passion.

Configuring Cura 4.3 for Makerbot Replicator 2

UPDATE: This method is a bit hacky, and breaks with updates – best to check on my newer method here

Wow this was harder than it should have been, so I’ll post what I can here to help you also.

We have 3 x Makerbot Replicator 2 3D printers, and for years used Makerware until it was discontinued for our printers and for Ubuntu it seems. So we’ve made the switch to Cura where all the cool kids hang out.

Of course Cura is primarily made for Ultimaker printers, but it can be configured for many others.

First up, I’m using it in Ubuntu Linux (18.04) so locations of files might need to be changed for your config files as needed.

Step 1: Set up your printer

I chose Makerbot Replicator from the printers page, and made a couple of changes as shown here:

I also renamed the machine name to “Replicator 2” just so I would remember.

Step 2: Start and end GCode

You’ll need some custom Gcode so here it is (picked from various places and organised after some testing).

Start Gcode:

; — start of START GCODE –
M73 P0 (enable build progress)
;this next line won’t work, but has the steps command
M92 X88.8 Y88.8 Z400 E101 ; sets steps per mm for Rep2
G90 (set positioning to absolute)
(**** begin homing ****)
G162 X Y F4000 (home XY axes maximum)
G161 Z F3500 (home Z axis minimum)
G92 Z-5 (set Z to -5)
G1 Z0.0 (move Z to “0”)
G161 Z F100 (home Z axis minimum)
M132 X Y Z A B (Recall stored home offsets for XYZAB axis)
(**** end homing ****)
G92 X147 Y66 Z5
G1 X105 Y-60 Z10 F4000.0 (move to waiting position)
G130 X0 Y0 A0 B0 (Set Stepper motor Vref to lower value while heating)
G130 X127 Y127 A127 B127 (Set Stepper motor Vref to defaults)
G0 X105 Y-60 (Position Nozzle)
G0 Z0.6 (Position Height)
; — end of START GCODE –

End GCode:

; — start of END GCODE –
G92 Z0
G1 Z10 F400
M18
M104 S0 T0
M73 P100 (end build progress)
G162 X Y F3000
M18
; — end of END GCODE –

This of course all assumes you don’t have a heated bed (also makes sure it doesn’t send heated bed commands which make the machine complain).

Step 3: Install X3G file converter

Go to the “Marketplace” button at the top right of your Cura window and in the marketplace search for “X3GWriter” and install it. Restart Cura so that it comes live.

Step 4: Modify X3GWriter so that it always detects “Replicator 2”

There seems to be a problem with X3GWriter in that with the above setup it always detects the machine to be a replicator 1, which is a problem as they have different amounts of steps per mm. You’ll know this because if you have a Replicator 2 and you try to print an object, it’ll keep printing larger than it should be. I’m sure there’s another way to make it detect “Replicator 2” but in the mean time I just changed it to always be Replicator 2 as that is all I have.

Locate your plugins folder – for me it’s in /home/username/.local/share/cura/4.3/plugins (where username is your username).

Go into the X3GWriter folder (and again into it, it’s nested twice – the path for me is: /home/username/.local/share/cura/4.3/plugins/X3GWriter/X3GWriter/)

Open “X3GWriter.py” with your favourite text editor. Be careful in here, it’s a python script so you want to use spaces, not tabs to indent, and indents matter. If you destroy it you may have to just remove the plugin and install it again.

We’re looking for the line like this:
return machine if machine in X3GWriter.known_machines else None

Note again that it’s indented with spaces in front. Put a # in front of this line to comment it out so it doesn’t get read like this:
#return machine if machine in X3GWriter.known_machines else None

Now go to the next line, press space until you’re lined up with the line above and put in:
return “r2”

Save the file and close Cura, then restart it. If all is well, you’ll find you can now export files that will print properly and be read by your Replicator 2.

If you find the X3G file option has disappeared from your list, then the plugin is broken. Check your syntax in the plugin file and try again.

Finally I can use a nice slicer on Linux and hang out with the cool 3D printer kids!

Video Triggering Software new home

I’ve been working again on my Raspberry Pi video triggering software again and have moved it to a new home at GitHub:
https://github.com/JesseCake/RPi_Triggered_video_player

It’s open source and free – in the hopes that it might be useful to other artists and creatives (or any situation requiring a looping or triggered video player).

I’ll be continuing to work on it into the future, but as we’re about to put it into service on our new commission launching at the end of the year, so it has to be stable!

Always welcoming comments or help with it – join the fun!

 

Triggered video kiosk software

I’ve been busy on a new piece of software, actually my first Python program which also happens to be my first piece of software I’ve open sourced.

I’m pretty happy with it so far, and already it does what I need it to. It’s rough, and of course could do with much better documentation, as well as bringing external modifications I’ve done in the OS internally to the program, but it works.

Basically it’s a replacement for very expensive signage hardware that allows triggering of HD videos through physical inputs (buttons, relays, other triggers) or via network packet based triggers. It runs on Raspberry Pi using the very good little omxplayer which pushes the videos through hardware decoding. It also allows logic programming so any kind of installation/usage is possible that requires video/sound.

Lastly, it can function purely as a simple video looper, but with the added benefit of seamless looping (seamless as in no black screen between loops, but there is a tiny pause of 100ms or so at the loop point) with player crash protection (if the player dies for some reason, it’ll relaunch).

It’ll run on the stock Raspbian Lite image (smaller, no bloat, no desktop) and draws directly to the framebuffer, which means no desktop, less ram usage, and more ability to handle large videos with the remaining RAM.

Eventually I’d like it to have the ability to show images in the logic, and other bits and pieces, but I’m also aware I’d like to keep the program small and light so that not many resources are used.

We will use it to replace the expensive commercial signage players we use in our artwork where videos/sounds are played synchronised with mechanisms and robotics at about a tenth of the cost with more control.

Hopefully it will help other artists and creatives along with anyone trying to build a video kiosk, or show a video in a gallery etc.

Here’s the link (free, open source, feel free to download and use):
https://gitlab.com/JesseCake/RPi_Triggered_video_player