1

This is my circuit. enter image description here

This is the code.

    #include "U8glib.h" // include the universal graphcs library
     
    U8GLIB_SSD1306_128X64 u8g(12, 11, 10, 9, 8);  // initialise a u8g display object
     
    const uint8_t flux_xbm[] PROGMEM = {
       0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0x56, 0x6D, 0xFF, 0xFF, 0xFF, 0xFF, 
  0xFF, 0xFF, 0xEF, 0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x5F, 0x69, 0x92, 
  0x6E, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xC1, 0xFF, 0xFE, 0xFF, 0xFF, 
  0xFF, 0x3F, 0x80, 0x01, 0xF5, 0x7E, 0xFF, 0xFF, 0xFF, 0xFB, 0x00, 0xC2, 
  0x3F, 0x21, 0xF4, 0xFF, 0xFF, 0xFF, 0x36, 0x6C, 0xBE, 0x7F, 0xFC, 0xFF, 
  0xFF, 0xFF, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x86, 0x61, 
  0xDE, 0x4F, 0xFE, 0xFF, 0xFF, 0xFB, 0x64, 0xE4, 0xFF, 0xFF, 0xFF, 0xFF, 
  0xFF, 0x3F, 0x20, 0x04, 0xFC, 0x63, 0xFA, 0xFF, 0xFF, 0xFD, 0x24, 0xCD, 
  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x95, 0xA9, 0x7F, 0x08, 0xFC, 0xFF, 
  0xFF, 0xF7, 0x27, 0xDA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0x00, 0x00, 
  0x04, 0x50, 0xFC, 0xFF, 0xFF, 0xFF, 0xD9, 0xC9, 0xFF, 0xFF, 0xFF, 0xFF, 
  0xFF, 0x3F, 0x10, 0x01, 0x21, 0x90, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 
  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x02, 0x84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x41, 0xA8, 0xFF, 0x5D, 0x77, 0x9F, 0xBF, 0xE6, 0x77, 
  0xFF, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xF7, 0xEF, 0xFE, 0xEF, 0xFF, 0xFF, 
  0xFF, 0xDB, 0xBF, 0xF7
    };
     
    void setup(void) {
    }
     
    void loop(void) {
      u8g.drawXBMP( 0, 0, 128, 64, flux_xbm); // send the xbm image to the display, specifying position and size
      while (1==1) {} // set the loop to only run once
    }

The image that it holds in XBM is this.

enter image description here The output is this. enter image description here What is it that I am doing wrong? Edit 1- As reported by user timemage. The xbm array was 64x128 instead of 128x64 I have changed the image added a more simpler one but that still does not solve the problem,

6
  • The image you included in the question is JPEG formatted, colored, 1920x1080 pixels and 155KB in size. How is that supposed to work with a 32KB Arduino and a 128x64 monochrome display? How did you convert the image to the format you put in your code? Does it work with much simpler and/or much smaller images?
    – StarCat
    Dec 16 '20 at 10:45
  • @StarCat If you see the size of the image I have input into the code in an array of type uint8_t called flux_xbm it would be 164x64. I used these two online apps image.online-convert.com/convert-to-bmp to convert to a grayscale 128x64 Bitmap and then used online-utility.org/image/convert/to/XBM to convert to a hex 2-D array. Dec 16 '20 at 10:50
  • Did you try this conversion tool with simpler monochrome images? Are you able to display other things besides XBM bitmaps i.e. is the display initialized correctly and are you able to control it from your code using the U8glib?
    – StarCat
    Dec 16 '20 at 10:55
  • @StarCat Yeah. I have used the same OLED display to depict three waveforms taken from 3 different sensors simul0taneously and individually displaying an image is the problem now. I was thinking about adding a menu connected to a rotary encoder or something to choose which waveform you want to see and add an image or something while the hardware calibrated. Dec 16 '20 at 11:00
  • @StarCat but as of now. Wrt the display plus this image no sensor is attached to the OLED and this is the code which I have used . Dec 16 '20 at 11:02
1

NOTE: This refers to an problem in the initial posting. The question has since been edited. This may be deleted later.


One problem, perhaps the problem, is that your given image appears to be 64x128 rather than 128x64:

rendered XBM

That said, I'm not sure exactly why the screen is showing precisely what it does.

When you do get this showing in the correct resolution, I expect you'll be a bit unimpressed with the result though.

3
  • thank you for pointing that out. It was a fault at my end. I have rectified it. But still the output is the same static I see. Should I change the CBM hex array in the question? or what is the procedure? Dec 17 '20 at 6:16
  • the problem is still no resolved. I tried other images. Everything from the drivers own constructors is working just these images are being difficult to show. Dec 17 '20 at 13:01
  • 1
    I misread the your first comment above. I don't know for sure what the correct procedure is, but I would say since the image dimensions and distortion aren't your primary problem, then yes, it makes sense for you to update your question with the corrected image array. You may want to add a note just saying that a previous edit had incorrect image data but it wasn't the principal problem. I may make a similar note in this answer or I may delete it. I will have to think about that.
    – timemage
    Dec 17 '20 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.