DKP - 40528
0 عدد موجود در انبار عدد موجود در انبار
این محصول در انبار موجود نیست
اخطار: آخرین موجودی فعلی!
تاریخ در دسترس بودن:
یکی از مناسب ترین شیلدهای رزبری X300 Expansion Board میباشد. علاوه بر فعالیت کارت صوت، یک USB Hub جهت ارتقاء پورتهای USB، ارتباط Wifi و بلوتوث، اینترفیس ساتا SATA در کنار یک تراشه زمان سنج فوق دقیق DS3231 به همراه باتری پشتیبان، میباشد. استفاده از این شیلد در بسیاری از پروژهها کاربردی خواهد بود.
راه اندازی و تنظیمات ساعت
Once you have installed I2C check that the RTC Pi has been detected using:
|pi@raspberrypi ~ $ sudo i2cdetect -y 1|
The RTC Pi should appear on channel 68 as shown in the screen shot below. If the RTC Pi does not appear check that the battery is installed correctly and is fully charged:
Enable I2C by running:
|pi@raspberrypi ~ $ sudo nano /etc/modprobe.d/raspi-blacklist.conf|
Find the I2C line where the I2c is black listed
Comment it out by replacing it with the line below
To ensure that the necessary kernel modules are loaded at boot, ensure your /boot/config.txt file has the entry below …
pi@raspberrypi ~ $ sudo nano /boot/config.txt
Save your changes by pressing Ctrl-x then Y
Edit /lib/udev/hwclock-set with
pi@raspberrypi ~ $ sudo nano /lib/udev/hwclock-set
Locate the lines and edit
Comment following three lines in config.txt by adding '#' located at start of the line.
Save your changes by pressing Ctrl-x then Y
Reboot your Raspberry Pi
|pi@raspberrypi ~ $ sudo reboot|
Get the right time set on the Pi ,
pi@raspberrypi ~ $ sudo date MMDDHHMMYYYY.SS
(MM= Month, DD= Date, HH= Hour, MM= Minute, YYYY= Year, SS= Second )
example: 2013 Jan 4 , 11:39:00 , sudo date 010411392013.00
Write the system time to the expansion board,
|pi@raspberrypi ~ $ sudo hwclock -w|
Verify the time ,
|pi@raspberrypi ~ $ sudo hwclock -r|
راه اندازی بلوتوث
To establish a communication with the Raspberry Pi over Bluetooth you need another device that can speak Bluetooth. If your computer has a Bluetooth adapter then you just need to find a terminal software that you can use to send and receive data, like HyperTerminal on Windows, or
screen on OS X and Linux. A computer is not the only choice, though. For example, I will use my Android cell phone with the free BlueTerm(download from Google play) app installed.
|RPi GPIO pin||BT module pin|
|GND (Pin #6)||GND|
|TXD (Pin #8)||RXD|
|RXD (Pin #10)||TXD|
I'm going to assume you are running a recent release of Raspbian on your Raspberry Pi. If you are running another OS then you will need to find out how the changes below are done in your system.
By default the Raspberry Pi is configured to write boot time messages to the serial port, and also to start a login console on it. Unfortunately, the default baud rate that the RPi uses for its serial port is 115200 bps, while the Bluetooth module comes preconfigured to 9600 bps. There are two config files that need to be updated.
/boot/cmdline.txt contains the kernel options that are used to boot the system. In my Raspbian based system this file contains the following options:
|pi@raspberrypi ~ $ sudo nano /boot/cmdline.txt|
|dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait|
|dwc_otg.lpm_enable=0 console=serial0,9600 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait|
Additional setting for Raspberry Pi 3 only (Not suitable for Raspberry Pi 2 and Pi Model B+)
If you've tried to use the UART on the GPIO header of the new Raspberry Pi 3, you may have been frustrated to discover that it doesn't work properly. until we get an official 'proper' fix (possibly setting PLLs correctly or dynamically with any changes to the core frequency), the best option seems to be setting the core clock to 250MHz, with core_freq=250 in /boot/config.txt.
|pi@raspberrypi ~ $ sudo nano /boot/config.txt|
Add the line core_freq=250 , Save and reboot!
With those changes made the RPi is configured to talk to the Bluetooth module. If you now power up your Raspberry Pi you will notice that the LED in the Bluetooth module blinks rapidly. This is the sign that the Bluetooth module is ready and waiting to be paired with another device.
Now leave the RPi running with the Bluetooth module in its blinking state and go to the Bluetooth enabled computer or smartphone that you will connect to it. Your device should now find the Bluetooth module with the name
BC04-B when you set it to discover devices.
If you are using an Android device with BlueTerm then start the app and from the app menu select "Connect device". Android does the baud selection automatically so you don't have to configure it. From a terminal software running in a computer it is likely that you will need to configure the speed, number of data bits per character, parity, and number of stop bits per character. The values you need to use are:
The Bluetooth module comes preconfigured with a PIN number. To complete the connection your computer or smartphone will ask you to enter this PIN. The factory default PIN is
The LED in the Bluetooth module will now stop blinking and remain lit, indicating that it has made a connection.
And here comes the fun part. You need to reboot the Raspberry Pi so that the new serial port settings take effect. To reboot the RPi run the following command in a local or network shell:
$ sudo reboot
Now watch the Bluetooth terminal on your PC or smartphone while the Pi reboots. Boot messages should be appearing on your terminal, and as soon as the RPi is up you should get a login prompt there as well.
You can now login from your Bluetooth terminal and use the command line prompt as you normally would over a local or network shell.
Firstly you will need to install
minicom into your RPi using the following command:
$ sudo apt-get install minicom
The Bluetooth module comes preconfigured from the factory with a set of defaults, which are:
But these values can be changed by sending special commands through the communication channel. Now that the Raspberry Pi is connected to the module we can try this.
These special commands that configure the Bluetooth module can be sent from a connected remote device, or they can be sent from the local system, in this case the Raspberry Pi. Since the Raspberry Pi is the star of the article I'm going to also use it to do the configuration.
Here is a quick summary of the most useful configuration commands:
|AT||Test the communication with the Bluetooth module.|
|AT+VERSION||Report the module's version number|
|AT+NAMEname||Change the Bluetooth ID to name (maximum 20 characters).|
|AT+PINnnnn||Change the PIN to nnnn, which must be a four digit number.|
|AT+BAUDn||Change the baud rate. Use one of the following values for n:|
One tricky aspect of sending these commands is that the Bluetooth module has a very short timeout, so all the characters in a command must be entered really quickly. The safest way to get the entire command in time is to type it in a text editor window and then use copy/paste to send it really fast.
To send the commands we can use
minicom. So let's fire it up one more time:
$ minicom -b 9600-o -D /dev/ttyAMA0
Note that it isn't necessary to have a connection to do this, so you can do this while the Bluetooth module is in its blinking state.
You now need to use any method to get the string
AT into the clipboard, and then hit paste inside the minicom window to send the command to the module.
When you send
AT the module should respond with this in the
If you get this response then you know that everything is all right. If you don't get a response then for some reason the Raspberry Pi is unable to communicate with the Bluetooth module.
When I send
AT+VERSION to the module I get the following response:
To change the baud rate to the fastest rate of 115200 we need to issue the command
AT+BAUD8, and the module will respond with:
Because the baud rate was changed now the communication will break, and we will need to exit and restart minicom with the updated speed:
$ minicom -b 115200-o -D /dev/ttyAMA0
To change the name of the module to MyBT we must issue the command
AT+NAMEMyBT, and the module will respond with:
And to change the PIN to 4321 the command is
AT+PIN4321 and the response from the Bluetooth module will be:
Note that when the name and/or the PIN change the module requires a power cycle for the changes to take effect.
Also don't forget that if you change the baud rate and later want to reestablish the serial console you will need to change the two config files to reflect the new baud rate you have selected in the Bluetooth module.