Madiraju put the free-floating bacteria, which are essentially tiny magnets, into plastic boxes less than a fifth of a cubic inch. Metal strips on two sides act as electrodes and get them spinning, generating a magnetic field and an electric current.