Marc's Public Blog


All | Aquariums | Arduino | Btrfs | Cars | Cats | Clubbing | Dining | Diving | Electronics | Exercising | Flying | Halloween | Hiking | Linux | Linuxha | Monuments | Museums | Public | Rc | Sciencemuseums | Snow | Solar | Trips




More pages: January 2020 December 2019 November 2019 October 2019 September 2019 August 2019 July 2019 June 2019 May 2019 April 2019 March 2019 February 2019 January 2019 December 2018 November 2018 October 2018 September 2018 August 2018 July 2018 June 2018 May 2018 April 2018 March 2018 February 2018 January 2018 December 2017 November 2017 October 2017 September 2017 August 2017 July 2017 June 2017 May 2017 April 2017 March 2017 February 2017 January 2017 December 2016 November 2016 October 2016 September 2016 August 2016 July 2016 June 2016 May 2016 April 2016 March 2016 February 2016 January 2016 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May 2015 April 2015 March 2015 February 2015 January 2015 December 2014 November 2014 October 2014 September 2014 August 2014 July 2014 June 2014 May 2014 April 2014 March 2014 February 2014 January 2014 December 2013 November 2013 October 2013 September 2013 August 2013 July 2013 June 2013 May 2013 April 2013 March 2013 February 2013 January 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 May 2012 April 2012 March 2012 February 2012 January 2012 December 2011 November 2011 October 2011 September 2011 August 2011 July 2011 June 2011 May 2011 April 2011 March 2011 February 2011 January 2011 December 2010 November 2010 October 2010 September 2010 August 2010 July 2010 June 2010 May 2010 April 2010 March 2010 February 2010 January 2010 December 2009 November 2009 October 2009 September 2009 August 2009 July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 October 2008 September 2008 August 2008 July 2008 June 2008 May 2008 April 2008 March 2008 February 2008 January 2008 December 2007 November 2007 October 2007 September 2007 August 2007 July 2007 June 2007 May 2007 April 2007 March 2007 February 2007 January 2007 December 2006 November 2006 October 2006 September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 February 2006 January 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 February 2005 January 2005 December 2004 November 2004 October 2004 September 2004 August 2004 July 2004 June 2004 May 2004 April 2004 March 2004 February 2004 January 2004 October 2003 August 2003 July 2003 May 2003 April 2003 March 2003 January 2003 November 2002 October 2002 July 2002 May 2002 April 2002 March 2002 February 2002 November 2001 October 2001 September 2001 August 2001 July 2001 June 2001 May 2001 April 2001 March 2001 February 2001 January 2001 December 2000 November 2000 October 2000 September 2000 August 2000 July 2000 June 2000 April 1999 March 1999 September 1997 August 1997 July 1996 September 1993 July 1991 December 1988 December 1985 January 1980




2020/01/15 Linux.conf.au 2020 Main Talk: Planning for and Handling Failures from Open Hardware, Aviation, to Production at Google
π 2020-01-15 01:01 in Google, Linux, Public
As part of LCA 2020, I gave my main talk Planning for and handling failures from open hardware, aviation, to production at Google.

The talk focussed on failures I've encountered in multiple fields, and what I learned from reading from other people's failures, a common practise in aviation that has saved countless lives in not re-creating failures and accidents out of ignorance.
As they say in aviation "experience is a cruel teacher: she gives you the test first, and if you survive, then you get to learn the lesson".

After looking at examples of failures we experienced at Google, I give a fair amount of examples from aviation, from AF447, QF32, and the Boeing 737 Max disaster which is so many failures in so many ways that it takes a while to describe in details. My hope is that engineers in a similar situation where they know they are getting overruled, can use other escallation steps to avoid disaster for others.

You can get the talk PDF or openoffice source from here. Otherwise, you can read the slides below and watch the video recording:




2020/01/14 LCA 2020 Talk, ESP32 Memory Management, Neopixels and RGBPanels
π 2020-01-14 01:01 in Arduino
As part of LCA 2020, I gave a quick talk at the Open Hardware Miniconf about a year's worth of work in ESP32 and upgrading my Shirt from 24x32 neopixels (P10) to 64x96 in RGBPanels (P4), giving me almost 10x more pixels.
Running lots of demo code at 96x64 in 24bpp, storing 2 framebuffers for page switching, plus bitplanes for PWM, it ended up significantly stressing the amount of fragmented memory available on ESP32, so this talk deals with what I learned and how to get around the limitations.

Then, I also brought a demo of my next version using Raspberry Pi and displaying a framebuffer of 128x192, using FastLED_RPIRGBPanel_GFX I wrote for the occasion :)


Demo of 64x96 with ESP32 and 128x192 on Rasberry Pi
Demo of 64x96 with ESP32 and 128x192 on Rasberry Pi


Talk video below:

2020/01/01 Running FastLED, Adafruit::GFX, and LEDMatrix code on High Resolution RGBPanels with a Raspberry Pi
π 2020-01-01 01:01 in Arduino
RBGPanels are a pain to drive, they require constant refreshing and it becomes more of a problem when you aim for higher resolutions (128x128 and above), as they require more horsepoewr and memory than either a teensy 3.6 or ESP32 can reasonably provide (the two top of the line chips supported by SmartMatrix)

Another issue is that SmartMatrix, while better than all the other libraries on arduino, doesn't support all kind of weird panels out there, specifically the AB and AC panels that you often end up getting when you get higher resolutions like 128x64.

Using Neopixels would work better of course, but they caan't reasonably be had in less than P5 (0.5cm/LED) while RGBPanels go down to P2. Also, neopixels are about 10X more expensive per pixel, if not more.
So, the solution is to use a rPi to drive RGBPanels of size 128x128 and larger (a single Pi with 3 parallel channels can reasonably run up to 256x256. After that it gets harder and you need multiple microcontrollers).

This is where the excellent https://github.com/hzeller/rpi-rgb-led-matrix driver comes in. It's the most feature complete RGBPanel driver for microcontrollers

Ok, but you have all this arduino code, maybe written for a FastLED::NeoMatrix or Adafruit::NeoMatrix array using the Adafruit::GFX API. Or maybe, you used the FastLED API with an XY mapping function, or maybe even you're using the LEDMatrix API for FastLED. None of those work on rPi, and you don't want to change/rewrite your code.

Well, there is good news: you can use https://github.com/ChrisMicro/ArduinoOnPc to run arduino code on PCs, and therefore also rPi. It is however designed to display in an X11 windows, which is not what you'd want. So, instead, I forked it for you and wrote a rPi glue driver for my FrameBuffer::GFX base class: https://github.com/marcmerlin/ArduinoOnPc-FastLED-GFX-LEDMatrix

You therefore end up getting access to those 3 arduino graphics APIs, and you can render on rPi using a much faster and the more feature complete https://github.com/hzeller/rpi-rgb-led-matrix driver

  • https://github.com/marcmerlin/Framebuffer_GFX is the base class you need for access to the 3 APIs I mentionned
  • https://github.com/marcmerlin/FastLED_RPIRGBPanel_GFX is the driver that glues rpi-rgb-led-matrix with ArduinoOnPc
  • https://github.com/marcmerlin/ArduinoOnPc-FastLED-GFX-LEDMatrix is my fork that adds a few fixes and git submodules for required libraries and demo code.
  • And this is what the end result, looks like with a cool resolution of 128x192 with 3 panels of 128x64 run in parallel with the active-3 board from https://github.com/hzeller/rpi-rgb-led-matrix/tree/master/adapter/active-3




    By using these driver options, I get about 400Hz refresh rate on rPi3, lowering the amount of pwm bits:
    ~/rpi-rgb-led-matrix/examples-api-use/demo --led-gpio-mapping=regular --led-rows=64 --led-cols=128 --led-row-addr-type=0 --led-chain=1 --led-show-refresh --led-slowdown-gpio=1 --led-parallel=3 --led-pwm-dither-bits=1 --led-pwm-bits=7 --led-panel-type=FM6126A -D0

    Those variables are assigned when you create "rgb_matrix::Canvas *canvas", which is fed into matrix->setCanvas(). See this example code:

  • https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/blob/022257656e2f1beabe327e88bb96747c0fc955f9/neomatrix_config.h#L262
  • https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos/blob/022257656e2f1beabe327e88bb96747c0fc955f9/neomatrix_config.h#L697
  • 2019/12/18 San Jose Xmas in the Park
    π 2019-12-18 01:01 in Public
    It had been a few years since we last went, and it looks like it grew bigger even more. Lots of trees and Xmas houses:
















    They had a very high tech LED tree which got the geek in me all interested :)





    See the video:

    See more images for San Jose Xmas in the Park
    2019/12/14 Xmas Lights for Date Night
    π 2019-12-14 01:01 in Public
    Jennifer planned a nice little outing for us, here are a few pictures of Xmas lights close to home.

    Palo Alto's University Avenue had a few lights, but nothing crazy:


    So we went to Stanford Shopping Center which had a few more lights:



    yum
    yum

    Jennifer then found a street known for lighting from all the houses within it (Fulton St in Palo Alto). Very nice find...










    Yet another house had an interesting train set running in and out of the house:




    Last, but not least, we went to the German Night Market in Mountain View:





    See more images for Xmas Lights for Date Night
    2019/12/07 Triode and Marlo at our last TFSF Event at Mezzanine
    π 2019-12-07 01:01 in Clubbing
    Unfortunately, Mezzanine is not allowed/able to renew their lease, so they are closing forever at the end of the year. This was our last TFSF event with them, going out in style with Triode and Marlo. Too bad, as the venue had gotten quite nice:


    I was at my company's Xmas party that night, but ducked out early to attend the most of the event, and it was worth it :)

    Triode opened early at 21:00 and played all the way to midnight:





    Marlo then took over at midnight and finished the night:






    Triode and Marlo during Triode's Castles in the Sky mix
    Triode and Marlo during Triode's Castles in the Sky mix



    2019/12/06 Berkeley Botanical Garden
    π 2019-12-06 01:01 in Public
    While in Berkeley with a bit of time to kill, we went to the very nice botanical garden. We only had 1H to go through it before it got dark, which wasn't enough. It was worth at least twice as long:

















    See more images for Berkeley Botanical Garden
    2019/12/06 A Few Night Pictures From Berkeley Hills Bay
    π 2019-12-06 01:01 in Public





    2019/12/03 Jennifer's Belated Birthday at Atelier Crenn
    π 2019-12-03 01:01 in Dining
    For Jennifer's BD, we booked a dinner at a new Michelin 3 star restaurant in SF, Atelier Crenn. We had to wait a bit until they had a free table for us, but it was worth it. It was a very fancy menu with an even fancier wine pairing (which actuall cost more than the tasting menu itself), and included many wines Jennifer had never tried before.

    Our last 3 star restaurant in SF was Saison and it was over $150 more expensive per person before wines, and honestly was not worth the price. Atelier Crenn is still quite expensive ($335 per person), but in comparison, was a better deal ;) (yes, I understand this is quite relative :) ).




















    2019/12/01 Using a Tesla Model 3 as Emergency Power Source In Case of Grid Failure
    π 2019-12-01 01:01 in Cars, Electronics
    Iwas interested in getting a decent amount of amps from my car while it's parked at home if I'm in a power emergency situation (i.e. no power) for maybe 2-3 days (as sadly is now a new "normal" in california).

    I knew that this could void the warranty on some parts of the car. I was ok with that. Tesla wants me to buy a powerwall, but I think powerwalls are stupid.

    I'd need to spend $30 to $40K in powerwalls to get the same amount of energy I already have in my car and I already paid for. Sorry, but I'm not spending that much for something I may need once every few years. Load shifting my solar in california is otherwise a straight loss, and PG&E forces some silly rules about not allow using powerwalls for time of use power arbitration if you accept the buying credit for them. You get penalized for helping take the peaks off the grid, yeah bureaucracy!
    If tesla sold a powerwall that would allow using your car as a battery source for emergencies only (car batteries are not designed for daily cycling like powerwalls), I'd be super interested, but they do not, so I decided to make my own answer.

    I knew that I could probably only get 2-3000W out of my car, honestly for emergency use (a couple of fridges and essential equipment), that's good enough. Sure, it wouldn't power all my house lights, or even my furnace for heating (which happens to use over 1000W just to run the fans), but eh, it's for emergency use only, so good enough.

    Plugging into the standby 12V battery

    What I knew from the beginning is that the battery in the car is way too small to power a proper size inverter (I have a 3000W one to be safe but honestly I only plan on using 1000W peak for my fridge and an average of 200W otherwise when the fridge is on). What I didn't know is that the Model 3 only provides trickle charge power to the battery, enough to charge it for normal use in the car, but not enough to recharge it if you plug a reasonable inverter into it (it will discharge quicker than it can recharge).

    My plan was to connect a big GLA 12V battery in parallel with the car's battery, so that it could absorb big peaks and buffer a it longer in case the car's battery recharge didn't kick in quickly enough. I did however confirm that the car's DC-DC system only recharges the standby battery at a slow rate, so it was not adequate for my need.

    Plugging into the cigarette lighter adapter

    For some uses, it would work to use some DC-DC charging system to recharge a big 12V battery external to the car and try to keep the car awake as much as possible so that the 12V CLA port stays on. The only issue with that plan is that you can only get about 12A sustained from it, so if you are planning on using over 100W average, this will not work in the end. In my case, my fridge was more in the 200W range.

    Tapping into the car's DC-DC system

    This is where things get interesting. The car's battery pack is in the 400V range, and 400V DC will definitely kill you (DC is actually worse than AC), so don't even think about messing with that unless you are truly a trained professional.
    For the rest of us, what you need to know is that the car has a DC-DC converter that turns 400V into 14V DC. This is used to power the car's systems when it's not sleeping, as well as recharge the small 12V battery that keeps things alive when the car is asleep. The idea is to tap directly into that 12V system which I'm told can provide up to 200A/2000W (which converted to 120V is really only 20A). A few things to note:
  • The 12V tap is available under the rear seats which you can remove by pushing to clips sideways
  • Connecting to ground is easy, connecting to the 12V pole is a bit more tricky. It's best to leave the current cable in there as it needs a perfect connection to conduct all the amps it's meant to carry. You can however add a 2nd connector on top of it an add a second nut on top (the bolt it long enough for this, and it seems to be purposely so)
  • If the DC-DC senses a short, it will shut down to protect itself. This is good, but also bad. The problem is that after it shuts down, it doesn't reset easily, or at all. Once it's shutdown, your standby 12V battery will discharge without being recharged, until it dies. You can recharge it with a 12V battery charger, but obviously this is only a temporary measure
  • If your DC-DC converter does not reset, you need to disconnect the 12V battery entirely, causing the entire car to shudown and reset. When I did that, my DC-DC converter came back online
  • Where it gets interesting, is that inverters come with a big capacitor to allow for transient loads. Those capacitors will take almost infinite energy when you connect them, causing a big spark, and looking like a short, causing the very undesirable shutdown explained above.
  • The solution is to wire a big resistor in front of your inverter so that it can charge its capacitor slowly
  • Then add a 200A relay to bypass the resistor when the inverter is 'charged'. The relay can be powered by connecting it to the inverter itself on the 12V side, making it so that when the capacitor is charged, the voltage across the inverter poles is high enough to actuate the relay and bypass the resistor.
  • The 2 white holes are where the clips that you need to release. are located. You can also see the black and red tap points:


    Building it up

    I used this:
  • 2000W pure sine wave inverter: https://www.amazon.com/SUDOKEJI-Inverter-2000W-Display-Outlets/dp/B07RWHN22W/ref=sr_1_1
  • 3000W NOT pure sine wave (cheaper and probably good enough for most loads): https://www.amazon.com/gp/product/B07FK3M6BB
  • 200A 12V relay: https://www.amazon.com/gp/product/B01MYPTVJD/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1
  • 100W 1.8Ohm: https://www.amazon.com/gp/product/B01N0XZN1F/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1
  • Optional 100A energy meter: https://www.amazon.com/gp/product/B013PKYILS/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
  • What happens is:

  • battery gets connected or DC-DC system turns on
  • resistor limits current and starts charging the capacitor in the inverter, slowly bringing the voltage across its poles from 0V to 12V
  • voltage across the inverter starts rising until 10V or whatever
  • once it's enough, the relay is energized and bypasses the resistor
  • now 200A can go to the inverter and no spark/current inrush was created, and your DC-DC converter doesn't shutdown when it turns on
  • This shows the current meter shunt connected to the bypass relay (which is powered by the connectors on the inverter side). You then see the thick 100W resistor connected in parallel with the relay. This allows current to flow more slowly and ramp up the connection:



    I tested a 1300W microwave which worked without issues, so did my fridge and other devices. The pure sine wave inverter is very important for a microwave, but a cheaper inverter worked well enough for my fridge and basic loads.

    Since we're talking about currents of 100A or more, we need to talk about wire gauge. The inverter I got came with 10AWG cables of about 1m. These cables are insufficient for 100A (never mind 200A), but in real life will mostly work for short distances and as long as you don't use the full power continuously (which could technically heat up the cable enough to melt its insulation and cause a short eventually). In my tests with 100A, I lost 0.7V due to inadequate wiring:

  • 0.25V lost in each of the two 10AWG cables (good quality)
  • Extra wire from relay to inverter lost 0.06V
  • 200A relay only lost 0.06V
  • 100A shunt for power meter lost 0.1V (and gets warm)
  • Given that the car outputs 13.5 to 14V, this drop is not big enough to matter since the inverter works all the way down to 10V or so, but be mindful of potential heat. Here is the end result:



    Keeping the DC-DC system awake

    One thing that you still need, it to keep the car from going to sleep if you want the DC-DC converter to stay on. Thankfully a recent software update added camper mode. You can just go in the climate screen/fan icon, set the car in park, and set 'keep climate on' to 'Camp', turn off AC and set the temperature to something low in order to save batteries (i.e. not waste the batteries into climate control).
    If you know of a more battery efficient way to keep the DC-DC system on without having to run climate or even having the control screens on, let me know (contact Email link at the bottom of this page). Hell, if you build one and get it working, shoot me an Email too :)

    Backfeeding your house

    If you really know what you're doing, you could use this with a custom made male-male outlet, to backfeed one or both phases of your house (it won't power anything 240V of course). The advantage is that you don't have to run extension cords and power existing lights in your house. If you do this, you must carefully disconnect utility power so that you don't backfeed the grid, as well as potential solar panels that could decide to sync with your inverter and feed more power than you're using, causing other issues you don't want to deal with. Of course, you'll find that 1000-3000W may not be enough power unless you do careful load shedding
    I'm not going to give more details because there is definite potential for things going wrong in many ways, but if you absolutely know what you're doing, there you go...

    Discussion Threads

    https://teslamotorsclub.com/tmc/threads/how-many-amps-can-you-get-from-the-12v-system-for-emergency-situations.178079/page-3#post-4371607 https://teslamotorsclub.com/tmc/threads/aftermarket-sub-woofer-amplifier-installation-using-dc-dc-12v-power-source.149582/page-2#post-4337510 https://teslamotorsclub.com/tmc/threads/master-thread-powering-house-or-other-things-with-model-3-12v-battery.140567/page-4#post-4371639

    More pages: January 2020 December 2019 November 2019 October 2019 September 2019 August 2019 July 2019 June 2019 May 2019 April 2019 March 2019 February 2019 January 2019 December 2018 November 2018 October 2018 September 2018 August 2018 July 2018 June 2018 May 2018 April 2018 March 2018 February 2018 January 2018 December 2017 November 2017 October 2017 September 2017 August 2017 July 2017 June 2017 May 2017 April 2017 March 2017 February 2017 January 2017 December 2016 November 2016 October 2016 September 2016 August 2016 July 2016 June 2016 May 2016 April 2016 March 2016 February 2016 January 2016 December 2015 November 2015 October 2015 September 2015 August 2015 July 2015 June 2015 May 2015 April 2015 March 2015 February 2015 January 2015 December 2014 November 2014 October 2014 September 2014 August 2014 July 2014 June 2014 May 2014 April 2014 March 2014 February 2014 January 2014 December 2013 November 2013 October 2013 September 2013 August 2013 July 2013 June 2013 May 2013 April 2013 March 2013 February 2013 January 2013 December 2012 November 2012 October 2012 September 2012 August 2012 July 2012 June 2012 May 2012 April 2012 March 2012 February 2012 January 2012 December 2011 November 2011 October 2011 September 2011 August 2011 July 2011 June 2011 May 2011 April 2011 March 2011 February 2011 January 2011 December 2010 November 2010 October 2010 September 2010 August 2010 July 2010 June 2010 May 2010 April 2010 March 2010 February 2010 January 2010 December 2009 November 2009 October 2009 September 2009 August 2009 July 2009 June 2009 May 2009 April 2009 March 2009 February 2009 January 2009 December 2008 November 2008 October 2008 September 2008 August 2008 July 2008 June 2008 May 2008 April 2008 March 2008 February 2008 January 2008 December 2007 November 2007 October 2007 September 2007 August 2007 July 2007 June 2007 May 2007 April 2007 March 2007 February 2007 January 2007 December 2006 November 2006 October 2006 September 2006 August 2006 July 2006 June 2006 May 2006 April 2006 March 2006 February 2006 January 2006 December 2005 November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 February 2005 January 2005 December 2004 November 2004 October 2004 September 2004 August 2004 July 2004 June 2004 May 2004 April 2004 March 2004 February 2004 January 2004 October 2003 August 2003 July 2003 May 2003 April 2003 March 2003 January 2003 November 2002 October 2002 July 2002 May 2002 April 2002 March 2002 February 2002 November 2001 October 2001 September 2001 August 2001 July 2001 June 2001 May 2001 April 2001 March 2001 February 2001 January 2001 December 2000 November 2000 October 2000 September 2000 August 2000 July 2000 June 2000 April 1999 March 1999 September 1997 August 1997 July 1996 September 1993 July 1991 December 1988 December 1985 January 1980

    Contact Email