ALCAM and the Arduino shield

Very excited to announce my Alcam Kickstarter camera and shield also arrived today.

I quickly tried the Arduino program but there was a few small issues:

  1. First issue is that one cannot upload the code to Arduino while the camera shield is connected. When I unplug the camera it loads fine, but with the camera shield plugged in it refuses to upload. (I have seen this same kind of behaviour at other times on other Arduino projects as well… it has something to do with the Tx or Rx line being pulled high or low or something). At least unplugging the camera while uploading is a work-around.

  2. Second issue : There is this comment in the code : [em] // Trgiiger the button to low state to start testing [/em]
    No, my issue is not the spelling mistake… but rather… which button does this refer to? There is no comments in the code that one should connect a button. BUTTON_PIN_ID is defined as Pin 3 of the Arduino which appears to be connected to the Alcam camera. I think a note in this sample code would help others a bit.

  3. I then commented the line that reads “if(digitalRead(BUTTON_PIN_ID)==0)” in order to avoid the button issue. But nothing comes out of the serial port, so I imagine the code probably does not even reach that point.

Did anyone else try the Arduino shield and Alcam Arduino example? Did you have to do anything special to get it to work?

Werner

  1. S

@ KiwiSaner -

  1. Confirm that if ALCAM is connected to Arduino then you may can not deploy the app. And you have the answer. PC, Arduino and ALCAM are using same line TX and RX. Just don’t plug ALCAM when you deploy the app.
  2. BUTTON_PIN_ID is defined as pin 3, meaning pin 3 of Arduino (on the board, you will see RX -> 0, TX -> 1, …),
  3. There are few things:
  • The driver supports 3 interfaces, UART, SPI, I2C. Current code in example is for SPI, you have to switch to UART.
    enable the line:
  //_g_alcam =  new ALCAM_Driver(ALCAM_Driver::I2cBus, BUSY_PIN_ID, LED_STATUS_PIN_ID);
  //_g_alcam =  new ALCAM_Driver(ALCAM_Driver::SpiBus, BUSY_PIN_ID, LED_STATUS_PIN_ID);
  _g_alcam =  new ALCAM_Driver(ALCAM_Driver::UartBus, BUSY_PIN_ID, LED_STATUS_PIN_ID);
  • Why did we add “if(digitalRead(BUTTON_PIN_ID)==0)”?
    Because hard to debug on Arduino, so we don’t want that when connected power then the board run automatically. Application should be started by user.
    Also remember that, when ALCAM is powered up, if default is UART, the banner string will be sent automatically, this happens before initializing uart of Arduino, so all banner will be lost, Arduino can not read this banner string.
    So when you switched to UART, also disable reading banner function:

//software_serial.println("Read the banner:") ;      
        //memset(PayloadBuf, 0x00, PAYLOAD_BUFFER_SIZE);
       // _g_alcam->ReadBanner(PayloadBuf);
        //software_serial.println( ConvertPayloadToString()) ;

But if for SPI and I2C, those lines must be enable. We will update this note in the example. But all codes are tested and works fine.

Thank you very much for the reply. I’m sure it works right and I will try again a bit later. I’ve been thinking in the meantime that maybe I should try with a different SD card as well. Not sure if the one I used is the right tipe, but I will take one from my Raspberry Pi products and try with that.

For the record… I checked the SD card and in fact the camera did indeed take pictures. I was previously expecting to see debug data coming out the Arduino USB connection, but noticed only later that in fact the example uses a software serial connection to output serial data via two ordinary IO pins as defined below.


 #define SOFTWARE_SERIAL_TX_PIN_ID 4
 #define SOFTWARE_SERIAL_RX_PIN_ID 5

So this means in order to see the debug outputs for Arduino code, I will probably have to wire up an FTDI serial to USB cable onto the shield. All and all I must admit the Arduino shield for the camera is a bit clumsy. There are various reason why I say this, namely:

  1. The fact that you have to unplug the camera each time you want to upload code to the Arduino. I
  2. The fact to you have to wire a separate FTDI serial to USB cable just to debug on the Arduino.
  3. The shield does not make it easy to connect anything else except the camera to the Arduino because it hogs almost all of the IO pins does not extend the IO pins to make it easy to connect anything else.
  4. The Arduino example was not written in the format of a proper Arduino library where you import the library and then see all the examples when you go to File -> Examples.

I suppose the intention of the shield was more to make it possible for a developer to use either SPI, I2C or Serial to talk to the camera. But I think for the common Arduino community it would have been much more beneficial if the Arduino used a software serial port to talk to the camera, but serial debugs still came out via the normal Arduino USB. Then one would not have had to unplug the camera to upload news software to the Arduino. I would also have liked to still have all the Arduino pins extended so I can still plug other Arduino shields below the camera one.

I realize this is something I can easily set up myself, but I think the typical Arduino user will not find this shield easy to use in its current form.

@ KiwiSaner -

This is just an option and you can ignore it, this does not effect to the example.

But then you won’t have any debug serial output and with Arduino that is like working blind. Anyway thanks, I understand now what is required and will be able to use make the neccessary modification I need myself.