Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - kevenlaker

1
Project logs / Creating Android BLE app
If you are an electronics enthusiast, and also fond of programming, I would be very glad to share with you an Android BLE application development method, so you can integrate the phone and MCU to do some more interesting things. Right now we begin to explain how to develop an Android BLE application, and you can also refer to the official Google tutorial . This guide is a packed tutorial, which enables you to build your Android BLE application more easily and more quickly. Of course, I’ll upload my source code for everyone to share it and you can also refer to the official sample sdk/samples/android-18/legacy/BluetoothLeGatt.

1. Create a new Android project
Open Eclipse,File->New->Android Application Project,and then fill the Application name in the Application Name edit box, for example, BleExample,or others. Minimum Required SDK selects API18:Android 4.3,and Target SDK also selects API18:Android 4.3,as buletooth 4.0 must be with Android 4.3edition or above. Others default unchanged and please continue clicking the Next button until Finish button appears,and then click the Finish button.

2. Add the permissions and services
Add the below code in the manifest file:
Code: [Select]
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
<service android:name="com.elecfreaks.ble.BluetoothLeService" android:enabled="true"/>

3. Create the ListView item layout file
Aiming to display each content of ListView, here we use customization(defining by yourself), so that each ListView can show more content,item_list.xml is demonstrated as below:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"   
    >
    <TextView android:id="@+id/textViewDevName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="24dp"/>
    <TextView android:id="@+id/textViewDevAddress"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="12dp"/>
</LinearLayout>
Copy the source code of BleExample /com.elecfreaks.ble to your project src directory,and then open the file with error prompt, pressing the shift+ctrl+O keys.

4. Modify activity_main.xml, increasing scanButton and bleDeviceListView
Increased contents are shown as below:
Code: [Select]
<Button
        android:id="@+id/scanButton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:onClick="scanOnClick"
        android:text="scan" />

    <ListView
        android:id="@+id/bleDeviceListView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/scanButton"
        android:layout_below="@+id/scanButton"
        android:layout_above="@+id/sendButton"
        >
    </ListView>
5. In MainActivity.java, add scanButton mothod of responding to events
Code: [Select]
public void scanOnClick(final View v){
}

6. Add member for MainActivity
Code: [Select]
private Button scanButton;
private ListView bleDeviceListView;
private BLEDeviceListAdapter listViewAdapter;

private BluetoothHandler bluetoothHandler;
private boolean isConnected;

Complete instructions and more details can be found at: http://www.elecfreaks.com/7906.html
2
Project logs / OV7670 Camera Module with Arduino
Here we introduced one OV7670 camera module just purchased online, including the communication of camera module and Arduino UNO, the using ways to take photo via camera module, and so on. This is an Arduino camera module,  adopted the Surveillance cameras digital image processing chip-OV0706, specially designed for image acquisition and processing application,  based on TTL communication interface, very convenient to connect with Arduino controller, able to read image and data via UART serial port, and then perform some image processing. This is a detailed DIY guide for the OV7670 TTL and UART camera, and you can also download the code from ElecFreaks.



Part 1  General description

This camera module can perform image processing such as AWB (auto white balance), AE (automatic exposure) and AGC (automatic gain control), for the video signal coming from CMOS sensor. What’s more, in fusion of other advanced technology such as image enhancement processing under low illumination, and image noise intelligent forecast and suppress, this module would output high quality digital video signals by standard CCIR656 interface. OV7670 built-in JPEG decoder supported reatime encoding for collected image, and external controller can easily read the M – JPEG video streams, achieving the camera design of double stream. OV7670 supported motion detection and OSD display function of screen characters and pattern overlay, capable of self-defining detection area and sensitivity.

Part 2  Test OV7670 camera module

Step 1  Needed tool for testing

Hardware:
1. SD Module
2. Digital key module
3. Arduino UNO
4. Jumper wire
5. USB cable
6. OV7670 camera module

Software:
1. Camera_VC0706_TEST
2. Arduino IDE(download it from official website)

Step 2 Hardware connection
1. Connect the hardware as below:


2. Here below is the physical diagram


Step 3  Software use and code programming

Refer to http://www.elecfreaks.com/7861.html for the full guide.
3
Project logs / DIY Smart RGB Strip with BLEduino
Smart RGB LED Strip is based on the development of our BLEduino, using the Bluetooth 4.0, and the sample code written by EF men, by mobile phone APP, to control the switch of RGB LED strip, and the RGB LED color changing. The main principle is that using BLEduino mega328P chip three PWM pins respectively to control the RGB LED strip of R G B three colors. When the phone APP and BLEduino bluetooth pairing connection succeed, phone APP can control mega328P chip three PWM pins output value, then control the the color of the RGB LED strip



This project is very easy – making, as long as with three things of BLEduino, BLE mobile phone APP, RGB LED Strip, we can complete it, which enable more Arduino starters to participate in this project. What’s more, we can apply this project to finish a Christmas tree with smart RGB LED Strip.

Visit http://www.elecfreaks.com/7849.html to read on and download codes.

4
General discussion / Problem with Elecfreaks TFT01-2.2SPI
1.   Problem with Elecfreaks TFT01-2.2SPI  (the demo testing code doesn’t work. Anybody can give me please some tips referring to this matter?)

2. Easy WiFi Can not Run Examples.
I have purchased 30 shields from ElecFreaks.
I can't find an example to run them properly. When I use the Adafruit library I get the message:

Wrong Firmware.

Pls help.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01342319280session_write_close ( )...(null):0
20.01372450856ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01372451632Database_MySQL->query( ).../DatabaseHandler.php:119
40.05692590352Database_MySQL->error( ).../Db-mysql.class.php:273