Project #15: Environment – Serial Camera – Mk29
https://www.donluc.com/?p=4361
#DonLucElectronics #DonLuc #Arduino #Camera #SD #RTC #EEPROM #Display #Elecrow #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant



Crowtail - Serial Camera
The Crowtail Serial Camera is a JPEG color camera module easy for PC and MCU use. It has integrated image processing DSP to generate 320 x 240 or 640 x 480 JPEG images without thumbnail information, captured pictures will be stored in the internal buffer and transferred via UART port. The UART Can be configured to TTL or CMOS by hardware.
-Crowtail interface
-Default baud rate of the serial port is 38400
-640 x 480 or 320 x 240 resolution
-JPEG compressed image without Thumbnail Information
-5 Volt power supply
DL2503Mk02
1 x Crowduino Uno - SD
1 x Crowtail - Base Shield
1 x Crowtail - Serial Camera
1 x Crowtail - Button 2.0
1 x MicroSD Card 4 Gb
1 x Crowtail - RTC 2.0
1 x CR1220 Battery
1 x Crowtail - LED(Green)
1 x USB Battery Pack
1 x USB Mini-B Cable
Crowduino Uno - SD
SCL - A5
SDA - A4
SCK - 12
MISO - 11
MOSI - 10
CS - 4
BUT - 9
LEDG - 6
VIN - +5V
GND - GND
DL2503Mk02p
DL2503Mk02p.ino
/****** Don Luc Electronics © ******
Software Version Information
Project #15: Environment – Serial Camera – Mk29
DL2503Mk02p.ino
DL2503Mk02
1 x Crowduino Uno - SD
1 x Crowtail - Base Shield
1 x Crowtail - Serial Camera
1 x Crowtail - Button 2.0
1 x MicroSD Card 4 Gb
1 x Crowtail - RTC 2.0
1 x CR1220 Battery
1 x Crowtail - LED(Green)
1 x USB Battery Pack
1 x USB Mini-B Cable
*/
// Include the Library Code
// EEPROM library to read and write EEPROM with unique ID for unit
#include <EEPROM.h>
// Wire
#include <Wire.h>
// Liquid Crystal
#include "LiquidCrystal.h"
// RTC (Real-Time Clock)
#include "RTClib.h"
// Secure Digital (SD Card)
#include <SD.h>
#include <SPI.h>
// Serial Camera
#include <Adafruit_VC0706.h>
// Software Serial
#include <SoftwareSerial.h>
// Camera TX connected to pin 2
// Camera RX to pin 3:
SoftwareSerial cameraconnection = SoftwareSerial(2, 3);
// Serial Camera
Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection);
// Create an image with the name DLEPxxx.JPG
char filename[13];
// Secure Digital (SD Card)
const int chipSelect = 4;
String zzzzzz = "";
// Button
int iButton = 9;
// Variable for reading the Button status
int iButtonState = 0;
// RTC (Real-Time Clock)
RTC_DS1307 RTC;
String dateRTC = "";
String timeRTC = "";
// Liquid Crystal
// Connect via i2c
LiquidCrystal lcd(0);
// LED Green
int iLEDGreen = 6;
// EEPROM Unique ID Information
String uid = "";
// Software Version Information
String sver = "15-29";
void loop() {
// RTC (Real-Time Clock)
isRTC();
// Display RTC
isDisplayRTC();
// Read the state of the Switch value
iButtonState = digitalRead(iButton);
// The Button is HIGH:
if (iButtonState == HIGH) {
// LED Green HIGH
digitalWrite(iLEDGreen, HIGH);
// Camera
isCamera();
// MicroSD Card
isSD();
// LED Green LOW
digitalWrite(iLEDGreen, LOW);
} else {
// LED Green LOW
digitalWrite(iLEDGreen, LOW);
}
// Delay
delay( 500 );
}
getCamera.ino
// Camera
// Setup Camera
void isSetupCamera(){
// Setup Camera
cam.begin();
// Biggest
cam.setImageSize(VC0706_640x480);
}
// is Camera
void isCamera(){
// Camera Snap
cam.takePicture();
// File Name
strcpy(filename, "DLEP000.JPG");
for (int i = 0; i < 1000; i++) {
filename[4] = '0' + i/10;
filename[5] = '0' + i/10;
filename[6] = '0' + i%10;
// create if does not exist, do not open existing, write, sync after write
if (! SD.exists(filename)) {
break;
}
}
// Open the file for writing
File imgFile = SD.open(filename, FILE_WRITE);
// Get the size of the image (frame) taken
uint16_t jpglen = cam.frameLength();
// Time
int32_t time = millis();
pinMode(8, OUTPUT);
// Read all the data up to # bytes!
byte wCount = 0; // For counting # of writes
while (jpglen > 0) {
// read 32 bytes at a time;
uint8_t *buffer;
uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups!
buffer = cam.readPicture(bytesToRead);
imgFile.write(buffer, bytesToRead);
if(++wCount >= 64) { // Every 2K, give a little feedback so it doesn't appear locked up
//Serial.print('.');
wCount = 0;
}
//Serial.print("Read "); Serial.print(bytesToRead, DEC); Serial.println(" bytes");
jpglen -= bytesToRead;
}
// Close
imgFile.close();
}
getDisplay.ino
// getDisplay
// Crowbits - OLED 128X64 UID
// Display UID
void isDisplayUID(){
// Set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
// Cursor
lcd.setCursor(0, 0);
lcd.print("Don Luc Electron");
// Cursor
lcd.setCursor(0, 1);
// Print a message to the LCD.
lcd.print( sver );
}
// Display RTC
void isDisplayRTC(){
// Clear
lcd.clear();
// Set the cursor to column 0, line 0
lcd.setCursor(0, 0);
lcd.print( dateRTC );
// Set the cursor to column 0, line 1
lcd.setCursor(0, 1);
lcd.print( timeRTC );
}
getEEPROM.ino
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
getRTC.ino
// RTC (Real-Time Clock)
// Setup RTC
void isSetupRTC(){
// RTC (Real-Time Clock)
RTC.begin();
// RTC Running
if (! RTC.isrunning()) {
// following line sets the RTC to the date & time
//this sketch was compiled
RTC.adjust(DateTime(__DATE__, __TIME__));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// RTC.adjust(DateTime(2014, 1, 21, 3, 0, 0))
}
}
// RTC (Real-Time Clock)
void isRTC(){
// RTC (Real-Time Clock)
DateTime now = RTC.now();
// Date
dateRTC = now.year(), DEC;
dateRTC = dateRTC + "/";
dateRTC = dateRTC + now.month(), DEC;
dateRTC = dateRTC + "/";
dateRTC = dateRTC + now.day(), DEC;
// Time
timeRTC = now.hour(), DEC;
timeRTC = timeRTC + ":";
timeRTC = timeRTC + now.minute(), DEC;
timeRTC = timeRTC + ":";
timeRTC = timeRTC + now.second(), DEC;
}
getSD.ino
// MicroSD Card
// MicroSD Setup
void isSetupSD() {
// MicroSD Card
// See if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
// Don't do anything more:
while (1);
}
}
// MicroSD Card
void isSD() {
zzzzzz = "";
//DLE|EEPROM Unique ID|Version|Date|Time|filename|
zzzzzz = "DLE|" + uid + "|" + sver + "|" + String( dateRTC ) + "|"
+ String( timeRTC ) + "|" + filename + "|";
// Open the file. Note that only one file can be open at a time,
// so you have to close this one before opening another.
File dataFile = SD.open("dledata.txt", FILE_WRITE);
// If the file is available, write to it:
if (dataFile) {
// Write
dataFile.println( zzzzzz );
dataFile.close();
}
}
setup.ino
// Setup
void setup()
{
// Delay
delay(100);
// isUID EEPROM Unique ID
isUID();
// Delay
delay(100);
// Initialize the LED LED Green
pinMode(iLEDGreen, OUTPUT);
// LED Green
digitalWrite(iLEDGreen, LOW);
// Delay
delay(100);
// Setup RTC
isSetupRTC();
// Delay
delay(100);
// MicroSD Card
isSetupSD();
// Delay
delay(100);
// Button
pinMode(iButton,INPUT);
// Delay
delay( 100 );
// Setup Camera
isSetupCamera();
// Delay
delay( 100 );
// Display UID
isDisplayUID();
// Delay 5 Second
delay( 5000 );
}
People can contact us: http://www.donluc.com/?page_id=1927
Electronics, IoT, Teacher, Instructor, R&D and Consulting
-Programming Language
-Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc...)
-IoT
-Wireless (Radio Frequency, Bluetooth, WiFi, Etc...)
-Robotics
-Automation
-Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
-Unmanned Vehicles Terrestrial and Marine
-Machine Learning
-Artificial Intelligence (AI)
-RTOS
-Sensors, eHealth Sensors, Biosensor, and Biometric
-Research & Development (R & D)
-Consulting
-Etc...
Follow Us
Luc Paquin – Curriculum Vitae - 2025
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
Hackster: https://www.hackster.io/luc-paquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
