QR code app not working with iPhone

Hi everyone.

I have used Aruduboy as my business card by creating qr code to contains the link to my vcf online.
Everything works okay when I tested on my phone which is Android.
I can use my phone scan the QR code and get the link to download vcf.

However, when I shared my QR code displaying with Arduboy screen to my friend who use iPhone. iPhone cannot read the QR code.

Could you please give me some suggestion to fix this.

Thank you so much.

That’s kind of strange. I wonder if it has to do with the QR code that is generated? Have you validated the QR code is correct maybe it can be printed out or viewed in a different medium?

I’m not sure what could make the iPhone read differently. A QR code is a standard thing.

What app are you using with the iPhone to try and read the QR code?

The only thing I can possibly thing that would be an issue here is the iPhone might be using it’s high frame rate mode to capture the image, in which case the screen flicker might be causing the issue.

1 Like

Yep Kevin hit the nail on the head, the qr code itself likely is perfectly fine, it is something to do with how the iPhone camera works that prevents it from reading properly when displayed on a multiplexed oled display like the arduboy’s. Maybe shutter speed/weird interleaving setting?/auto focus mechanism/white balance/etc … could be a number of things. The easiest experiment would be if you can place the camera app into a manual mode and tweak image settings to get it as clear as possible and see if it works then. In the end it also greatly depends if the app cares about if the qr code is inverted or not (black pixels on light background or vice versa) or just does edge detection or something.

What’s the code like?

I’m wondering if maybe the QR code is being redrawn each frame and the phone ends up seeing the unfinished frames and thus being unable to identify the QR code properly.

If that is the case then it should be possible to fix it by just drawing the QR code once, displaying it and then putting the Arduboy into an endless loop (with an arduboy.idle() call to conserve power).

(Another option would be to try tweaking the contrast I suppose.)

1 Like

This suggestion that @pharap gives should work I think!

@aaronamm can you share where you got the code from?

Hey @aaronamm did you ever have any success on this? We think we found a solution for you, would love to close this issue out!

1 Like

Hi everyone

This is follow up of https://community.arduboy.com/t/qr-code-app-not-working-with-iphone-solved/7875

I am so sorry for late reply in the previous post. I was so busy and not in a city.

BTW, I tried to set the refresh rate as suggestion but it still does not work on iPhone.

This is link to my source code.

If you want to try it please crate Variable.h in the root folder, same level as usinessCard.ino and put these contents to it.

    const unsigned char PROGMEM qrCode[] =
    {
        // width, height,
        64, 64,
        0xff, 0x01, 0x01, 0xf9, 0xf9, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0xf9, 0xf9, 0x01, 0x01, 0x01, 0xff, 0xff, 0xe7, 0xe7, 0xe7, 0x01, 0x01, 0x1f, 0x1f, 0x1f, 0x07, 0x07, 0xe7, 0xe7, 0xe7, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0xe7, 0xe7, 0xe1, 0xe1, 0xe1, 0xff, 0xff, 0x01, 0x01, 0x01, 0xf9, 0xf9, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0xf9, 0xf9, 0x01, 0x01, 0x01, 0xff, 
        0xff, 0x00, 0x00, 0x7f, 0x7f, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x1c, 0x1c, 0xfc, 0xfc, 0x03, 0x03, 0x03, 0xfc, 0xfc, 0x63, 0x63, 0x63, 0x80, 0x80, 0x1c, 0x1c, 0x1c, 0x9c, 0x9c, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0xff, 
        0xff, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x7c, 0x7c, 0x8c, 0x8c, 0x8c, 0x0f, 0x0f, 0x0c, 0x0c, 0x0c, 0x0f, 0x0f, 0x8c, 0x8c, 0x8c, 0xff, 0xff, 0x80, 0x80, 0x80, 0x0f, 0x0f, 0x8c, 0x8c, 0x8c, 0x83, 0x83, 0x70, 0x70, 0x70, 0x0f, 0x0f, 0xfc, 0xfc, 0xfc, 0x0c, 0x0c, 0xfc, 0xfc, 0xfc, 0x8c, 0x8c, 0xfc, 0xfc, 0xfc, 0x0c, 0x0c, 0xfc, 0xfc, 0xfc, 0xff, 
        0xff, 0x3f, 0x3f, 0xc1, 0xc1, 0xff, 0xff, 0xff, 0xce, 0xce, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x31, 0x31, 0x31, 0xf0, 0xf0, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0xcf, 0xcf, 0xcf, 0x01, 0x01, 0x31, 0x31, 0x31, 0x30, 0x30, 0x01, 0x01, 0x01, 0x01, 0x01, 0xce, 0xce, 0xce, 0x00, 0x00, 0x31, 0x31, 0x31, 0x00, 0x00, 0x31, 0x31, 0x31, 0xf1, 0xf1, 0x3f, 0x3f, 0x3f, 0x30, 0x30, 0x01, 0x01, 0x01, 0xff, 
        0xff, 0x00, 0x00, 0xff, 0xff, 0x07, 0x07, 0x07, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0x3e, 0x3e, 0xc6, 0xc6, 0xc6, 0xff, 0xff, 0x3f, 0x3f, 0x3f, 0x06, 0x06, 0x39, 0x39, 0x39, 0xfe, 0xfe, 0xf8, 0xf8, 0xf8, 0xc0, 0xc0, 0x06, 0x06, 0x06, 0xc6, 0xc6, 0x01, 0x01, 0x01, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x06, 0x06, 0x06, 0xc1, 0xc1, 0xfe, 0xfe, 0xfe, 0xc0, 0xc0, 0x06, 0x06, 0x06, 0xff, 
        0xff, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0xf8, 0xf8, 0xf8, 0x00, 0x00, 0xf8, 0xf8, 0xf8, 0xe7, 0xe7, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0xe7, 0xe7, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0xff, 
        0xff, 0x00, 0x00, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0x03, 0x1f, 0x1f, 0x1f, 0x80, 0x80, 0xe3, 0xe3, 0xe3, 0x03, 0x03, 0x7c, 0x7c, 0x7c, 0x63, 0x63, 0x80, 0x80, 0x80, 0xe3, 0xe3, 0x83, 0x83, 0x83, 0xe3, 0xe3, 0x80, 0x80, 0x80, 0x1c, 0x1c, 0x03, 0x03, 0x03, 0x9f, 0x9f, 0x1f, 0x1f, 0x1f, 0xff, 
        0xff, 0x80, 0x80, 0x8f, 0x8f, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0x8f, 0x8f, 0x80, 0x80, 0x80, 0xff, 0xff, 0x80, 0x80, 0x80, 0xf0, 0xf0, 0x8c, 0x8c, 0x8c, 0xf3, 0xf3, 0x83, 0x83, 0x83, 0x8c, 0x8c, 0x8c, 0x8c, 0x8c, 0xf0, 0xf0, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xff, 0xff, 0xff, 0x83, 0x83, 0x83, 0x83, 0x83, 0x80, 0x80, 0x8c, 0x8c, 0x8c, 0x8f, 0x8f, 0x80, 0x80, 0x80, 0xff, 
    };

The content of QR code is https://www.codesanook.com

Tool that I use for generating QR code are listed in
https://github.com/codesanook/CodeSanook.Examples/blob/master/Codesanook.ArduboyBusinessCard/README.md

Thank you so much. I really appreciate what you replied in the last post.

I moved the response into this thread!

I don’t have an iPhone so I won’t be able to help with the testing :frowning:

Although I used to have one, and had a QR code example that did work, so not really sure what’s up.

I would try moving these 3 lines to the setup() function after setFrameRate

arduboy.clear();
Sprites::drawOverwrite(32, 0, qrCode, 0);
arduboy.display();

This may fix the issue because it avoids needlessly updating the display.

If those are moved into setup then you may as well strip out if(!arduboy.nextFrame()) return; as well.

If the display is never being cleared or updated then there’s no need to maintain a framerate anymore.
Also delay(1000) and delay(250) will be interfering anyway.

However, that will mean the CPU is no longer being idled.
Fortunately there’s a solution to this.
Simply add:

void yield()
{
	Arduboy2Core::idle()
}

And then delay should call yield, which will in turn call idle which will sleep the CPU whilst it’s waiting for the time to elapse.

So the final code should look like:

#include <Arduboy2.h>
#include "Variable.h"

Arduboy2 arduboy;

void yield()
{
    Arduboy2Core::idle()
}

void setup()
{
    arduboy.begin();
    Sprites::drawOverwrite(32, 0, qrCode, 0);
    arduboy.display();
}

void loop()
{
    int leds[] = {RED_LED, GREEN_LED, BLUE_LED};
    for (int index = 0; index < 3; index++)
    {
        arduboy.setRGBled(leds[index], 4);
        delay(1000);
        arduboy.setRGBled(0, 0, 0);
        delay(250);
    }
}

(There’s no need to do arduboy.setFrameRate(60); or arduboy.clear(), because arduboy.begin() already does both.)


Lastly, while space saving isn’t really important here,
I just want to point out that it’s possible to save some space:

#include <Arduboy2.h>
#include "Variable.h"

Arduboy2 arduboy;

void yield()
{
    Arduboy2Core::idle()
}

void setup()
{
    arduboy.begin();
    Sprites::drawOverwrite(32, 0, qrCode, 0);
    arduboy.display();
}

void loop()
{
    const uint8_t leds[] PROGMEM { RED_LED, GREEN_LED, BLUE_LED };
    for (uint8_t index = 0; index < 3; ++index)
    {
        const uint8_t led = pgm_read_byte(&leds[index]);
        
        arduboy.setRGBled(led, 4);
        delay(1000);
        
        arduboy.setRGBled(led, 0);
        delay(250);
    }
}

No clue if any of this solves the iPhone problem though.
I don’t own a smartphone of any kind.

1 Like

Have you tried not using the LED? That could be a far bigger issue as it’s dramatically brighter than the screen.

I’ll bet it’s the LED.

1 Like

I like the idea that he uses an Arduboy as a business card … but what an expensive card that is if it only shows a QR code. Maybe print the QR code on the back of the Arduboy and develop a really cool ‘resume’ for the Arduboy itself?

2 Likes

It’d be cool to attach the arduboy to a serial thermal printer and print out your business card/qr code on receipt paper to hand out.

2 Likes

Totally unrelated but I thought about making a cell phone case with a thermal printer, you have to manually pull the paper through because the motor is the big part, the thermal head is actually pretty small.

1 Like

Or add a crank. :P

1 Like

Hello everyone.

Thank you so much for your replies.
All response are value to me.

However, my friend who has iPhone has tried to figure it out the problem with me.

We found something interesting we have the QR code show in our computer monitor and then used iPhone to read that QR code.
The result is, it works.

I think the problem can be the LED hardware of Arduino that cannot fit iPhone.
If anybody has iOS device, please help me try this.
The normal camera app in iOS has built-in support for QR code.

Thanks gain and really appreciate for this.

Thank you so much of the example of code improvement.

1 Like

This is a good idea.
However, I did it but it does now work.

Thank you so much. I started with this post first but I could not replied it because it was already solved.

Please note that I didn’t have chance to test the code.

If you test any of my code and it doesn’t work,
let me know and I’ll try to find time to fix it.


Also, you can reply to more than one person at a time.

You can either mention them by name, e.g. @aaronamm,
or you can highlight part of their post, click the ‘quote’ box that appears and a quote will be added to your reply.