Category: Diagnostics

  • Pi with FAN-SHIM problem diagnosis

    I purchased a FAN-SHIM and Raspberry Pi 4 from Pimoroni last year but occasionally saw a problem, and struggled with a diagnosis.

    The FAN-SHIM generally worked great, but I noticed that it didn’t seem to always work when I didn’t have a lead coming off the header to a breadboard. The fan would just run, the LEDS wouldn’t work – it was basically unhappy. Given it was directly related to the cable, I took the easy route to fixing things – leave it attached! However, I always wanted to properly diagnose what was going on.

    A picture of a Raspberry Pi 4 showing the FANSHIM in place , showing the friction fit header pushed over the GPIO pins - waiting for diagnosing problems!
    Stock Pi 4 with a FAN-SHIM plugged in.

    Exploring Problems with the FAN-SHIM on a Pi

    I recently had a chance to look at this again, and this is collecting my exploration and thoughts. In short, I did a lot of hunting about, until I found something that really helped me diagnose things. I knew the installation was working – as I said, with the cable attached all is good. However, I didn’t really want it plugged in all the time. It looked like it was pushed on OK – but I had no control.

    How could I work out if it was the SHIM with an issue, my Pi or something else?

    Eventually, I found this page. A comment by gadgetoid suggested a really good diagnostic approach.

    Diagnosing the FAN-SHIM problem on the Pi

    Basically, turn the fanshim service off:

    systemctl stop pimoroni-fanshim.service

    Then, start up python and run the following:

    import RPi.GPIO as GPIO
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(18,GPIO.OUT)
    GPIO.output(18,0) # Should turn fan off
    GPIO.output(18,1) # Should turn fan on

    Basically, run the command to get the fanshim to do what it isn’t at the moment. Then adjust the fanshim until the action actually happens – so in my case it finally turned off!

    Having done this, I could run now run the other test scripts in the fanshim example source code.

    Finally the LED would change as expected, and the fan would turn on and off as expected.

    I now re-enabled the fan-shim service:

    systemctl start pimoroni-fanshim.service

    Now, I know how to check things if it goes wrong again!

  • Testing MathJax

    Writing maths works as in LaTeX. Use dollar signs to enclose inline math, e.g. \(x^2\) \(x^2\) \(x^2\) $$x^2$$

    \(
    \begin{align}
    E &= mc^2 \\
    m &= \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}}
    \end{align}
    \)

    \(\int_{-\infty}^\infty e^{-\pi x^2}\,\mathrm{d}x=1\label{a}\tag{1}\)

    \ref{a}
  • This is a reasonably complete sample of using MathJax.

    Sample has been taken form here:
    https://groups.drupal.org/node/1263

    MathJax documentation is here:
    http://docs.mathjax.org/en/latest/

    Wonder how much of this works:
    https://yutsumura.com/mathjax-in-wordpress/

    Writing maths works as in LaTeX. Use dollar signs to enclose inline math, e.g. \(x^2\).

    Examples for paragraph math are \(x^2 \) and \(x^2\) (both variants are equivalent).

    There is also a display-style inline math environment, compare \(\sum_{k=1}^\infty \frac{1}{k}\) and \(!\sum_{k=1}^\infty \frac{1}{k}\).

    To make a dollar sign, you have to type \$ as in LaTeX!
    Using just $ doesn’t work.
    Latex: \(\$ \)
    and
    Latex: \($ \)

    Arbitrary LaTeX code can be rendered as in this example:
    Let $x^2$ be a natural number. 

    There are also more elaborate environments to write math – they support auto-numbering, referencing and more. These environments are <equation> and <equations>. They both support the same attributes.

    E.g. rendering an equation with a different resolution:
    <equation>e^{i \cdot \pi} = -1<equation>.

    To give the equation automatically a number, you have to give it an id:
    e^{i \cdot \pi} = -1.

    You now can produce a link to that equation by typing \\ref{euler}, or even better (\\ref{euler}).

    You can also give it a name instead of a number:
    e^{i \cdot \pi} = -1.

    An example for the <equations> environment is given by:
    \(
    \int \ln(x) \;dx
    &= \int 1 \cdot \ln(x) \;dx \
    &= x \cdot \ln(x) – \int x \cdot \frac{1}{x} \;dx \
    &= x \cdot \ln(x) – x
    \)

    The spaces on the left are optional.

    To prohibit some text from being processed by DruTeX, you can use <code> and <notex>:
    e.g. $x^2$
    or
    $x^2$
    Humm… doesn\’t work!

    \(\left(\int_{-\infty}^\infty e^{-x^2}\ dx\right)^2\ =\ \pi (\ref{test}) \)

    Extra bit

    \(e^{ \pm i\theta } = \cos \theta \pm i\sin \theta\)

  • Getting annoying error with phpMyAdmin

    I upgraded phpMyAdmin from 4.1.2 from 4.2.6. Having done this, I copied in the config.inc.php file and started everything up.

    Logged in and I get “You should upgrade to MySQL 5.5.0 or later.”.

    Well yes, I should. But I can’t (the mysql version is attached to the NAS – so i can’t really change that very easily). But I want to use phpMyAdmin. Checked on phpMyAdmin site, and it says “supported only on MySQL 5.5”.

    Anything after here is at your own risk. I have not comprehensively tested this, nor have I any intention of doing that.

    Right, so with that out of the way, After digging about for a little bit I found that the error is being generated by:

    libraries/common.inc.php

    If you open this up, there is a line:

            if (PMA_MYSQL_INT_VERSION < 50500) {

    Change it to say:

            if (PMA_MYSQL_INT_VERSION < 50100) {

    And now “hey presto!” it won’t complain anymore.

    Although we SHOULD all really upgrade to MySQL 5.5, or MariaDB, or move to PostgreSQL

    Again, if you do this and it breaks things its not my fault.
    I wanted to make it so i could see tables in MySQL again. I rarely user phpMyAdmin for much more than that anyway.

  • Updating Language of postings in Drupal.

    Everything said it was undefined language (very weird).

    Found this post so I ran this update:

    UPDATE node SET language = 'en' WHERE language = 'und';

    And it did exactly what it says on the tin (turned everything set to und to en).

    Perfect!