Camera Module – Photos & Videos

Dabble Camera and Video

Like any general camera application present in mobile camera and video module also allows you to take pictures and videos but it also allows you to handle these activities by sending the command from your hardware.

You can send the command from your board to:

  1. Record videos
  2. Capture images
  3. Flip camera to front or rear
  4. Change flash mode to ON, OFF or Auto
  5. Change zoom scaling
  6. Set camera quality to High or Low.

Camera Module

The Camera module allows you to use your mobile camera for different activities like recording videos, capturing images, color detection, and face detection. Depending on the type of activities you want to do with your mobile camera the module is further divided into four modules each capable of executing a specific activity.

Camera Module

These modules are:

  1. Camera and Videos
  2. Color Detector
  3. Line Follower (Coming Soon)
  4. Face Detector (Coming Soon)

Camera and Video Module

Like any general camera application present in mobile this module also allows you to take pictures and videos but it also allows you to handle these activities by sending the command from your hardware.Camera and Video

You can send the command from your board to:

  1. Record videos
  2. Capture images
  3. Flip camera to front or rear
  4. Change flash mode to ON, OFF or Auto
  5. Change zoom scaling
  6. Set camera quality to High or Low.

Control of the same things is also possible from icons present in the module. You can view the images or videos captured through this module by clicking on the gallery icon present in middle at the top right corner of your screen beside the connect icon.

Arduino IDE Functions

Header

To include the Camera and Video module in the Arduino program, you have to include the following header:

#define CUSTOM_SETTINGS

#define INCLUDE_CAMERA_MODULE

After defining the above mention headers, you have to include the dabble library:

#include <Dabble.h>

You can download zip of Dabble-Arduino (for evive, Uno, Mega and Nano) or Dabble-ESP32 depending board you are using.

Enabling Bluetooth Communication

To enable Bluetooth communication, you have to initialize serial communication using the following code:

For evive and Arduino Mega, Uno and Nano

Dabble.begin(Baud_Rate);

Here Baud_Rate is the baud rate set for the Bluetooth module. With evive, you normally get 115200 baud rate modules.

For ESP32

Dabble.begin("Bluetooth_Name");

In place of Bluetooth_Name enter name that you want to keep for bluetooth of ESP32. Default name given in library is “MyEsp32”.

Refreshing the data

To refresh the data that the device has got from the mobile app, you have to use the following line of code:

Dabble.processInput();

This function also change the state and the brightness of the LED automatically and you don’t have to do anything.

Functions

Following are the function available for the Camera and Video module:

  1. captureImage() – Sends command to click images.
  2. startRecording() – Sends command to start video.
  3. stopRecording() – Sends command to stop video.
  4. flipTo(direction) – This function sends the command to rotate the camera to front or rear. There are two constants namely FRONT and REAR defined in the library to change camera direction. Pass either of constant as an argument in place of “direction” in the function.
  5. setQuality(quality) – This function sends the command to set quality of camera. Using this function quality of camera can be set to high or low. There are two constants namely HIGH_QUALITY and LOW_QUALITY. Pass either of constant as an argument in place of “quality” in the function.
  6. flashMode(modeName) – This function sends the command to set flash mode. Using this command flash can be set to On, Off or Auto mode. There are three constants namely ON, OFF and AUTO . Pass either of the constant as an argument in place of “modeName” in the function.
  7. zoom(value) – Enter a value between 0 – 100 for setting that much percentage zoom on your mobile camera.
  8. setParameters(Direction, flash, quality, zoom) – This function allows you to set all basic camera settings before taking image or video. The direction of the camera, the flash status, quality and zoom value are passed as arguments to this function in sequential order as written. All this parameters are constants mentioned in above functions.

PictoBlox (Scratch) Blocks

There are three blocks in this module. All three blocks a explained below:

  • set camera flash to” is a stacked block used for changing flash settings, camera quality and zoom settings of camera. The block consists of two drop down  and a numeric entry section each helps in setting a unique parameter of Camera.

           First drop-down is for flash setting, it allows you to set flash mode to On, Off or Auto.

           

         Second drop-down is for setting quality, it allows you to set camera quality to high or low. Enter zoom percent between 0 to 100 in text field of zoom for getting that much % of zoom for camera. 

  • rotate camera to”  is a stacked block used to rotate camera in the module. Its drop down contains two option namely “rear” and “front” for rotating camera to front or rear side.
  • capture image on camera” is a stacked block used to send command for clicking image, starting video and stopping video in camera module. Its drop down consists of three options namely “Capture Image” , “Start Video” and “Stop Video”. 
evive Notes Icon
Note: When you are using this module with Arduino Uno, Mega, and Nano,  you have to set the Bluetooth baud rate to the baud rate of the Bluetooth module to have proper communication between the board and the module. To set the baud rate you have to use set Bluetooth baud rate to () block.

set bluetooth baud rate to

Examples

There are two scripts given below , out of which one is for capturing image and one is for recording 30 second video. Both the scripts are made for Stage Mode in PictoBlox. Both the scripts will work for evive and Arduino Uno, Nano and Mega. Currently PictoBlox does not support ESP32; however its support will be added soon. 

Capture Images

Record Videos

evive Notes Icon
Note: When working with evive or any of your Arduino board on PictoBlox for the very first time, or if you’ve previously uploaded another code to your board , you must upload the firmware in order to work in stage mode. You can find the procedure for the same here.

 

 

In this example you will capture images and record video with different camera settings.

Follow these steps:

  • Copy code as per your board in Arduino IDE
  • Upload code
  • Connect with Dabble and open Camera and Video module

evive

Following activities occur while pressing slide switch and tactile switches on evive:

  1. On pressing Tactile Switch 1 –  a High quality image is captured from front camera.
  2. On pressing Tactile Switch 2 – a Low quality image is  captured in auto flash mode from rear camera.
  3. On sliding up Slide Switch 1 –  a High quality video recording starts from rear camera with 50% zoom. 

Mega , Uno and Nano

After uploading code open serial monitor. you will be able to see instructions printed on Serial Monitor asking you to enter any number between 1 to 4. For each number there is  a task mentioned that will be executed.

ESP32

After uploading code open serial monitor and reset your board once. You will be able to see instructions on serial monitor follow them to capture images and videos from Camera Module.

 

 

 

Leave a Reply

Leave a Reply

Close Menu
×
×

Cart

STEMpedia Starter Kit is now available on Indiegogo!
STEMpedia Starter Package is now on Indiegogo!
Get 41% OFF with Super Early Bird discounts!
x