Sunday, November 8, 2015
Sunday, November 1, 2015
- Tamiya Educational Construction Series No.168 : Double Gearbox (Left/Right Independent 4-Speed)
- Tamiya Education Construction Series No.193 : Slim Tire Set (36mm, 55mm Dia.)
I'm planning to connect the car into Raspberry Pi 2 so that it can turn left and right with various verocity.
Saturday, October 17, 2015
I installed apache2 and php5. Then, I called /usr/sbin/i2cset and i2cget via exec command from PHP script. i2cset can't run because apache2 run on www-data user by default. /var/log/apache2/error.log shows there is no root privilege.
I added the following lines into /etc/sudoers:
www-data ALL=(ALL) NOPASSWD:/usr/sbin/i2cget
www-data ALL=(ALL) NOPASSWD:/usr/sbin/i2cset
Now I can call "sudo /usr/sbin/i2cset" by exec command. I can access it from Android Tablet by setting PHP URL.
Sunday, October 11, 2015
I connected the LCD into Raspberry Pi2's 3.3V, GND, and SDA signals. I didn't put pull-up resistors because those signals are pulled-up internally by Raspberry Pi 2.
I2C address of the LCD is 0x3E. "i2cdetect" command returns 0x3E correctly.
LCD shows characters by sending commands via I2C according to initialize steps written in the usage manual of the LCD. Sometimes commands failed, but they succeeds if I put long wait time. I found that the command fails if the I2C baud rate is 100000 of default value. If I change it by 50000, command succeeds stably. We can change the baud rate by writing the following lines into /boot/config.txt:
Saturday, October 10, 2015
SG92R have 3 signal lines: 5V, GND, and control signal. 4 AAA battery should be connected to 5V signal. I connected the control signal to Raspberry Pi 2's PWM port. We can control rotate angle by using PWM port.
I used "softServo", which is one of wiringPi library, to control the servo motor. We can download wiringPi by using:
git clone git://git.drogon.net/wiringPi
Running ./build in wiringPi folder will make wiringPi library under /usr/local/lib folder. However, This library doesn't include softServo.c, which is required to control server motor. I have to change Makefile so that it build softServo.c too. wiringPi library have already exist in /usr/lib at NOOBS 1.4.2, so,
gcc -o test test.c -lwiringPi
cause an missing function error because it first search /usr/lib/libwiringPi.xx first. So, I use the following command:
gcc -o test test.c -L/usr/local/lib -lwiringPi
I run the command and the servo motor moved by 120 degree with Brrr-r-r sound.
Tuesday, August 4, 2015
I bought MPU-6050 by 400 yen. It has 3-axis gyroscope, a 3-axis accelerometer, and temperature sensor. It can be controlled via I2C. I soldered pin-headers and inserted it into a breadboard.
There are open source libraries of I2C communication for Raspberry Pi. I can find the assigned address for I2C by using "i2cdetect" command. I referred Reading data from the MPU-6050 on the Raspberry Pi for how to control MPU-6050. 3D graphics shows well how gyroscope detects the movement.
I could learn characteristic of analog electronic circuit by actually trying sensors.