Quantcast
Channel: LinkSprite Learning Center
Viewing all 562 articles
Browse latest View live

How to enable security in OpenHAB

$
0
0

When using OpenHAB to control our house, we would like to have to security in place.  The way to enable security in OpenHAB is to edit the file named openhab.cfg. Look for the line starts with ‘security:option=’.

If we do ‘security:option=EXTERNAL’, it means that only when we try to connect to the OpenHAB server from external network, i.e., Internet, it will ask for username/password. It will not ask for credentials.

If we do ‘security:option=ON’, it will always ask for username/password.

 

Once the security is turned on, we can add the username and password to the file user.cfg, for example,

Username password

ben=password1

scott=password2


Interface Explanation of HI3518 IP Camera Development Board

$
0
0

HI3518 is a chipset from HiSilicion that can be used to power  720p IP camera. In this article, we explain the interface headers of the development board.

hi3514

 

Marker PCB Silkscreen No Description Function
P1  J6  1 Infraed Control Input Signal Input
2 GND Ground
3 NC Not Connected
P2  J7 1 IR-CUT Control Signal Output
2 IR-CUT Control Signal Output

 

Maker PCB Silkscreen Items Description Function
P3 J1 1 ETHRX- Signal for ETHERNET
2 ETHRX+ Signal for ETHERNET
3 LEDLINKA Network speed indicator LED
4 ETHTX- Signal for ETHERNET
5 ETHTX+ Signal for ETHERNET
6 NET_LED_ACT Network Connection Status LED
P4 J3 1 NC Not Connected
2 NC Not Connected
3 GND Ground
4 +12V_IN +12V

 

P5

1 RXD which is connected to TXD of the TTL UART to USB

2 TXD  which is connected to RXD of the TTL UART to USB

3 GND

 

The setting of serial port:

串口设置

Automatically Mount SATA drive on pcDuino3B

$
0
0

pcDuino3 family has a SATA host can be used to hook a SATA drive. In this post, we mount a WDC laptop SATA drive to pcDuino3.

IMG_5750

 

When we use a drive with pcDuino, please pay special attention to the power supply and USB cable. It needs to be able to deliver 2A. Otherwise, the hard drive has difficulty booting up.

We format the WDC drive on another PC as ntfs, name its volume as ‘owncloud’, and has only one partition.

 

Click ‘Disk Utility’, and we can click ‘Mount Volume’ to mount the drive.

IMG_5746

 

In the following, we will see how to automatically mount drive during pcDuino boot up.

To achieve that, we add a line to the file named /etc/fstab:

IMG_5748

 

 

As we want the user ‘ubuntu’ to be able to use the mounted drive, we will find out the group id of the user ‘ubuntu':

IMG_5754

The gid is ‘1002’.

 

Now, we enter the line as below:

IMG_5757

 

Save and power cycle pcDuino. After it booted up, we will see the sata drive is automatically mounted.

IMG_5758

 

 

Article 0

pcDuino Street Pong

pcDuino3 nano CW Keyer

IRIS Hand: Winner of the 2014 Intel-Cornell Cup Competition

Testing teleoperation of my robot with a gamecontroller

$
0
0

Testing teleoperation of my robot with a gamecontroller. Robot is contrrolled/programmed with ROS Groovy

Workstation is a Notebook with Lubuntu 12 and ROS Groovy

Embedded PC on Robot is a pcDuino3 with ROS Groovy

All sources can be found on github in repository :

https://github.com/Scheik/ROS-Groovy-…

More info about the project can be found on:

https://www.the-starbearer.de


Enable UART5 and UART6 on pcDuino3

$
0
0

This was posted on the linksprite forums by Bharath Rao.

Original discussion can be found here.

I have enabled 2 serial ports, UART 5 and UART 6.

http://www.rs-online…b-host-pcduino3 This link has the steps to extract script.bin file and edit it and repack it.

http://jbvsblog.blog…to-4-uarts.html This has the procedure to enable UARTs in the script.fex file

After editing the script.bin and copying it to your /boot partition, reboot.

To check whether the UARTs are enabled run the command

$ dmesg | grep uart

[    2.359573] [uart]: used uart info.: 0x65

[    2.361581] [uart]: serial probe 0 irq 33 mapbase 0x01c28000
[    2.384244] sunxi-uart.0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a U6_16550A
[    3.203940] [uart]: serial probe 2 irq 35 mapbase 0x01c28800
[    3.232197] sunxi-uart.2: ttyS1 at MMIO 0x1c28800 (irq = 35) is a U6_16550A
[    3.241474] [uart]: serial probe 5 irq 50 mapbase 0x01c29400
[    3.269817] sunxi-uart.5: ttyS2 at MMIO 0x1c29400 (irq = 50) is a U6_16550A
[    3.279181] [uart]: serial probe 6 irq 51 mapbase 0x01c29800
[    3.307665] sunxi-uart.6: ttyS3 at MMIO 0x1c29800 (irq = 51) is a U6_16550A
[    5.825632] USB Serial support registered for ch341-uart

 

To enable UART 5(ttyS2) we first need to set the pin mode.

GPIO10 – UART5_TX

GPIO13 – UART5_RX

 

$ echo “3” > /sys/device/virtual/misc/gpio/mode/gpio10

$ echo “3” > /sys/device/virtual/misc/gpio/mode/gpio13

 

Similarly for UART 6 (ttyS3)

GPIO11 – UART6_TX

GPIO12 – UART6_RX

 

$ echo “3” > /sys/device/virtual/misc/gpio/mode/gpio11

$ echo “3” > /sys/device/virtual/misc/gpio/mode/gpio12

 

I have attached the script.fex file I used to enable them. You could just rename it to script.fex and use it.

Attached Files

pcDuino Android SSH communication

Installing Lubuntu 14 on pcDuino using Windows (win32diskimgwrite method)

Artificial test the vision of pcDuino

$
0
0

Video shows the operation of the machine vision by pcDuino is (red dodging obstacles, crossing the blue, green and stopping in front of the yellow) along the movement direction by Arduino.

111Please take care of the wheel changing as the Iron https://www.youtube.com/watch?v=kEcAwW8FTCw

 

Interface of pcDuino-Metas

DIY using ESP8266 WiFi module for OpenHAB on pcDuino

$
0
0

HomeMatic-HomeGear-Raspberry-piHome automation is a hot topic AGAIN recently. Among the many open source solution,  we choose  openHAB. The openHAB  project is aimed to provide the general platform for home automation. openHAB can run perfect on the pcDuino platform, can be used to DIY smart home project.  pcDuino serves as the server/gateway in the whole system. The remote client node uses the STM8L Low Power Microcontroller, which is a custom designed MCU board. They communicates to the pcDuino OpenHAB server  using  the low power WiFi module ESP8266 Serial WIFI Module.  In this particular project, we implemented a remote client that detects the status of the door status using a door status contact sensor. It senses the status and communicate the current state to pcDuino through the WiFi, and then pcDuino pushed the data using mqtt to openHAB server that resides on pcDuino. The openHAB server will then update the status on the mobile side.  We also implement the other way around. We press a button on the mobile APP, and then openHAB will push a message to the remote node to turn on a LED. The mobile APP can be downloaded form Android or Apple app store by searching for ‘openhab’.

First we need to install the openHAB relate software, the detail can refer to LinkSprite Learning Center: http://learn.linksprite.com/?s=openhab

If you do not want to install yourself.  Please download the install the the image that we prepare for you (openHAB was installed under  under the /opt/openhab Directory) ;

http://pan.baidu.com/s/1ntHtCyX?qq-pf-to=pcqq.c2c  Extraction code:fh6c

1  x  STM8L Module Board (other suitable MCU is OK)

1  x  ST-link (use for STM8L download debugging )

1  x  Door switch sensor

1  x  ESP8266(WIFI)

2  x  AA 5 type battery

1  x  pcDuino3 

Plz notice the following code command setting:

The IP address for pcDuino and the SSID, password for current Wireless Router

/* 
 * www.linksprite.com
 * 20/05/2015
 */

#include "stm8l10x.h"
#include "stdio.h"
#include "string.h"

#define LED_ON()       GPIO_ResetBits( GPIOC, GPIO_Pin_4 )
#define LED_OFF()      GPIO_SetBits( GPIOC, GPIO_Pin_4 )

#define key  GPIOB,GPIO_Pin_1

// CE_BIT:   Digital Input     Chip Enable Activates RX or TX mode
/**
  * @addtogroup USART_Printf
  * @{
  */
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
#ifdef _RAISONANCE_
 #define PUTCHAR_PROTOTYPE int putchar (char c)
 #define GETCHAR_PROTOTYPE int getchar (void)
#elif defined (_COSMIC_)
 #define PUTCHAR_PROTOTYPE char putchar (char c)
 #define GETCHAR_PROTOTYPE char getchar (void)
#else /* _IAR_ */
 #define PUTCHAR_PROTOTYPE int putchar (int c)
 #define GETCHAR_PROTOTYPE int getchar (void)
#endif

/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
static void USART_Config(void);
void ESP8266_Start(void);
void delay(unsigned int time);
void TCPTEST(void);
void TCPSend(char* senddata);
int Send_Command(char* ATcommand,char* ReturnValue,unsigned long time_out);
void low_gpio(void);

int i=0,j=0;

static int doorflag = 0;

@far @interrupt void NonHandledInterrupt (void)
{
   EXTI_ClearITPendingBit(EXTI_Pin_1);
   if( (GPIO_ReadInputDataBit(key)==0)&&(doorflag==0) )
            { 
              LED_ON();
              TCPSend("OPEN");
              doorflag = 1;
            }

            if( (GPIO_ReadInputDataBit(key)) && (doorflag==1) )
            {
                 LED_OFF();
                 doorflag=0;
               TCPSend("CLOS");
             }
}

void main(void)
{
    int flag=0;
    USART_Config();
    delay(2);
    low_gpio();
    GPIO_Init(GPIOB,GPIO_Pin_1, GPIO_Mode_In_PU_IT);
    EXTI_SetPinSensitivity(EXTI_Pin_1, EXTI_Trigger_Rising_Falling);
    GPIO_Init( GPIOC, GPIO_Pin_4, GPIO_Mode_Out_PP_High_Slow);
    LED_ON();
    USART_ClearFlag();
    enableInterrupts();

    flag = Send_Command("AT","OK",50);
    flag = Send_Command("AT+RST","OK",20);
    flag = Send_Command("AT+CWMODE=1","OK",50);
    flag = Send_Command("AT+CWJAP=\"ssid\",\"password\"","OK",50);
    flag = Send_Command("AT+CWJAP?","OK",50);
    flag = Send_Command("AT+CIPSTART=\"TCP\",\"192.168.1.155\",10000","OK",50);

    LED_OFF();

    while(1) halt();
}

void delay(unsigned int time)
{
    while(time--)
    {
        for(i=0;i<50;i++)
        {
            for(j=0;j<2000;j++);
        }
    }
}

void TCPSend(char* senddata)
{
    Send_Command("AT+CIPSEND=4",">",50);
    Send_Command(senddata,"OK",50);
    //delay(1);
}

void TCPTEST(void)
{
     static int led=0;
     int answer=0, count=0;
     char receive[30]=" ";
     unsigned long num=0;
     char rec='';
      char sw= ''; 
         do{
         if(USART->SR & USART_SR_RXNE)
         {
            rec = USART->DR; //USART_ReceiveData8();
            receive[count] = rec ;
            count++;
            USART_ClearFlag();
       }
         j++;
         if(j==1000)
     {   
             j=0;
             num++;
        }
         if(num>1) 
            {
                answer=0;
              break;
            }
         }
        while(strstr(receive,"OK")==NULL);
        if( (strstr(receive,"GO")!=NULL)||(strstr(receive,"33")!=NULL) ) led++;
      if(led%2) { LED_ON();}
      else {LED_OFF();}
         memset(receive,'\0',30);
         count = 0;
}

int Send_Command(char* ATcommand,char* ReturnValue,unsigned long time_out)
{
     int answer=0, count=0;
     char receive[100]=" ";
     unsigned long num=0;
     char rec='';
    if (ATcommand[0] != '\0')
    {
        printf(ATcommand);    // Send the AT command 
                printf("\r\n");
    }
         do{
         if(USART->SR & USART_SR_RXNE)
         {
            rec = USART->DR; 
            receive[count] = rec ;
            count++;
            USART_ClearFlag();
       }
         j++;
         if(j==1000)
     {      
                j = 0;
                num++;
                if(num>time_out) 
                {
                    answer=0;
                    break;
                }
       }
         }
         while(strstr(receive,ReturnValue)==NULL);
         memset(receive,'\0',100);
         count = 0;
         answer=1;
    return answer;
}

void low_gpio(void)
{
    GPIO_Init(GPIOB,GPIO_Pin_0, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOB,GPIO_Pin_2, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOB,GPIO_Pin_3, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOB,GPIO_Pin_4, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOB,GPIO_Pin_5, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOB,GPIO_Pin_6, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOB,GPIO_Pin_7, GPIO_Mode_In_FL_No_IT);

    GPIO_Init(GPIOA,GPIO_Pin_0, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOA,GPIO_Pin_1, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOA,GPIO_Pin_2, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOA,GPIO_Pin_3, GPIO_Mode_In_FL_No_IT);

    GPIO_Init(GPIOC,GPIO_Pin_0, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOC,GPIO_Pin_1, GPIO_Mode_In_FL_No_IT);
    GPIO_Init(GPIOC,GPIO_Pin_4, GPIO_Mode_In_FL_No_IT);

    //GPIO_Init(GPIOC,GPIO_Pin_2, GPIO_Mode_In_FL_No_IT);
    //GPIO_Init(GPIOC,GPIO_Pin_3, GPIO_Mode_In_FL_No_IT);
}

/**
  * @brief  Configure USART peripheral to print characters on Hyperteminal
  * @param  None
  * @retval None
  */
static void USART_Config(void)
{/* High speed internal clock prescaler: 1*/
    CLK_MasterPrescalerConfig(CLK_MasterPrescaler_HSIDiv8);

     /*Set the USART RX and USART TX at high level*/
    GPIO_ExternalPullUpConfig(GPIOC,GPIO_Pin_3|GPIO_Pin_2, ENABLE);
     //GPIO_ExternalPullUpConfig(GPIOC,GPIO_Pin_3|GPIO_Pin_2, DISABLE);
    /* Enable USART clock */
    CLK_PeripheralClockConfig(CLK_Peripheral_USART, ENABLE);

    USART_DeInit();
    /* USART configuration ------------------------------------------------------*/
    /* USART configured as follow:
          - BaudRate = 115200 baud  
          - Word Length = 8 Bits
          - One Stop Bit
          - No parity
          - Receive and transmit enabled
    */
     USART_Init((uint32_t)9600, USART_WordLength_8D, USART_StopBits_1,
               USART_Parity_No, (USART_Mode_TypeDef)(USART_Mode_Rx | USART_Mode_Tx));

                                //USART_ITConfig(USART_IT_RXNE, ENABLE);

    /* Enable general interrupts */
  //  enableInterrupts();
}

/**
  * @brief  Retargets the C library printf function to the USART.
  * @param  c Character to send
  * @retval char Character sent
  */
PUTCHAR_PROTOTYPE
{
  /* Write a character to the USART */
  USART_SendData8(c);
  /* Loop until the end of transmission */
  while (USART_GetFlagStatus(USART_FLAG_TXE) == RESET);
  return (c);
}

#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *   where the assert_param error has occurred.
  * @param file: pointer to the source file name
  * @param line: assert_param error line source number
  * @retval : None
  */
void assert_failed(uint8_t* file, uint32_t line)
{ 
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif

1. Install openHAB and the mobile equipment APP for pcDuino 

图片1

2. Download the sample code of STM8L into STM8l

图片2

3. Separately Weld the 2 lines on the door forbid sensor to PB1 and GND ( code set the PB2 as Pullup input, when the Magnetic blocks door forbid sensor near the receive port, the IO level will be low.

图片3

4. Power for pcDuino , run the open HAB and python MQTT:

Start openhab::

$cd /opt/openhab

$sudo ./start.sh

( If refresh the well done openHAB image, add  the auto start sudo /opt/openhab/start.sh  to /etc/rc.local  )

Run MQTT:( Here use the python to build a socket server port to monitor the date sending from WIFI from STM8L Module )

cd /home/ubutu

$sudo python ./mqtt_publish.py

图片4

*The IP address is modified as the pcDuino assigned address ( input  $ifconfig to check), modify position as following:

图片5

5. When the below program start, we press the reset key on STM8L Module, then we can see the model is well connected with pcDuino, and start the date transmitting:

图片6

6. Now we can open the mobile equipment APP software, click settings, do the following set:

图片7

IP address will modify according to the pcDuino real address, about the user name and the password, set as following:

$cd /opt/openhab/configurations

$vim ./users.cfg

And the “test” is the user name, the “12345678” is the password:

t图片8

7. After setting done, click the right corner “Save” to save the setting, then back to the main interface:

When the door is open state:

图片9

 

图片10

When the door is close state:

图片11

图片12

pcDuino3B, Python Turtle Graphics

$
0
0

pcduino

The Original post from: https://www.youtube.com/watch?v=8OeaM-nejQE


Eleduino Pcduino V3 Transparent Acrylic Dog Bone Shape Case Enclosure

$
0
0

pcduino acrylic

The original post from https://www.youtube.com/watch?v=lPW26kZnlgs

Running Android on the PcDuino3

$
0
0

pcduino Android

 

A video to show the pcDuino Android system: ps://youtu.be/d-3IaoZLXJU?t=41

 

What’s the difference between P5 and P6 for a LED panel?

$
0
0

 

 

 

 

 

 

When it comes to RGB LED panel, we heard P5, P6 many times. How to decode it?

P actually means pitch. The number after it is the pitch in units of mm.  So P5 means a panel with a pitch of 5mm, and P6 means a panel with a pitch of 6mm.

 

ledscreen

How to Burn Windows10 IoT Core RPI2 to a SD card for Rasberry Pi2

$
0
0

1. Raspberry Pi2

2. 8G 10 class Micro SD card

3. LCD monitor( If it’s VGA , we need a HDMI to VGA adapter.)

4. Mouse

5. PC which running Windows 10.

1. Windows 10 IoT for Raspberry Pi2(Windows_IoT_Core_RPI2_BUILD.zip)

You can download here:

https://connect.microsoft.com/windowsembeddedIoT/Downloads/DownloadDetails.aspx?DownloadID=57782

Extracting the file flash.ffu and save in your PC.

2. Windows ADK

Install Visual Studio 2015 RC, then you will have the tools.

Or you can download and install separately, Just install Deployment tools and Flashing tools.

It’s need about 57.6M space.

Here is the download link:

https://go.microsoft.com/fwlink/p/?LinkId=526740

Windows Assessment and Deployment Kit

1. Open command prompt(Admin)

Use the command to check the sd card’s number.

diskpart
list disk
exit

Command Prompt

You can see the SD card’s number is 4.

2. Burn Windows10 IoT

Use cd command change to the directory where the file flash.ffu is.

The use the command to burn the firmware.

Note: Must use your SD card’s number. For example, my SD card’s number is 4, then it should be /ApplyDrive:\\.\PhysicalDrive4

dism.exe /Apply-Image /ImageFile:flash.ffu /ApplyDrive:\\.\PhysicalDriveN /SkipPlatformCheck

 

win10iot

3. Windows 10 IoT start up

Plug the SD into Raspberry Pi2 and then power on.

If  everything goes well, you will see Windows 10 logo. And then the screen will turn black for several minutes.

IMG_20150605_051518

 

 

Support mouse, but only two place can be controlled, one is Device setting and the other one is Power on or off.

 

IMG_20150605_051455

 

Get the RTSP stream from the OpenHapp Plug and Play WiFi IP Camera

$
0
0

OpenHapp has a really nice looking and easy to use plug and play WiFi IP security camera. Many users would like to directly access the RTSP stream from it. In this post, we show how to access the rtsp stream.

 

In the mobile APP NVSIP,  tab the camera that you would like to access, and tap ‘Setting’,

IMG_6210

 

and then ‘Net Setting':

IMG_6209

 

Then click ‘Ethernet’ and then DHCP, we will find out the IP address for the target camera:

IMG_6208

 

 

Download VLC media play (you can google VLC media player), and enter the rstp address as below:Screen Shot 2015-06-14 at 9.37.57 PM

 

It will ask for username and password. The username is ‘admin’, password is blank. After that we should be able to see the video streaming.

Viewing all 562 articles
Browse latest View live