-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathREADME.Pi
More file actions
76 lines (50 loc) · 4.02 KB
/
README.Pi
File metadata and controls
76 lines (50 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Getting MOVI to work on a Raspberry PI 3
========================================
1) Connect MOVI onto Raspberry Pi using adapter the Adapter sold by Audeme or the wiring scheme in this Instructable:
https://www.instructables.com/id/Untethered-Speech-Dialog-Using-MOVI-With-the-Rasbe/
Beware that some steps have changed. This README presents an update.
Connect the Raspberry PI to a power supply with at least 2 Amperes. If the power supply has not enough power, the Raspberry PI will complain "Undervoltage detected" and show a "Lightning bolt" in the upper right corner.
2) Download latest Raspbian:
https://www.raspberrypi.org/downloads/raspbian/
Install on SDCard, start Raspberry PI, follow steps including updating process.
3) Start a terminal and edit /boot/config.txt, for example:
sudo nano /boot/config.txt
Add the following lines to the end of the file:
dtoverlay=pi3-disable-bt
core_freq=250
enable_uart=1
4) Now edit /boot/cmdline.txt
sudo nano /boot/cmdline.txt
remove the word phrase "console=serial0,115200" or "console=ttyAMA0,115200"
5) Reboot the Raspberry PI.
6) Find out which devices files exist now. This seems to be dynamic.
For me: /dev/serial0 is the one that MOVI responds to. /dev/ttyS0 or /dev/serial1 give an input/output error. The easiest way to find out is to do an:
stty -a -F <devicefile>
where devicefile is one of /dev/ttyAMA0, /dev/serial0, /dev/ttyS0, or /dev/serial1. The one with the lowest number that doesn't return an error should be used.
7) Type "Make" and wait for the examples to compile. The examples are the same as in the Arduino version.
8) Browse through the examples directory. The .ino files contain the C++ source code and the executables run just like the Arduino versions.
If your communication device is not /dev/serial0 you can pass an alternative device as first command line parameter. For example:
/examples/beginner/LightSwitch/LightSwitch /dev/serial1
We highly recommend browsing the source codes and playing around with them as this is the best way to learn MOVI. We are also working on a Python version that does not require the Piduino core.
Have fun!
APPENDIX
A) GPIO Mappings
The digital GPIOs are mapped in the following way:
// Arduino Digital PIN to Raspberry PI GPIO mappping. This can be changed in Arduino.h
// Arduino Pins: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13
// Pi Pins: 10 8 7 11 12 13 15 16 18 22 29 31 32 33
// Caution: Don't use pins D1 and D2 as they are UART RX/TX and are being used for communication with MOVI.
An LED on Arduino pin D13 therefore goes to Raspberry PI 3 pins 33 and 39 (GND). An LED on Arduino pin D12 (see password example) goes to pins 32 and 39 (GND).
The analog and PWM GPIOs are not yet supported. Check the piduino_light/sysfsio.cpp file for more information.
B) Compiling your own programs
The "make" command creates two libraries: libpiduino and libmovi. Libpiduino implements the Arduino core and libmovi implements the MOVI library based on some Arduino core. You will need libmovi and some Arduino core to compile your own MOVI programs. Btq. you are free to use libpiduino without MOVI if you are just interested in programming some Arduino sketches on the Raspberry PI.
1) Compiling Arduino sketches without MOVI library
Use:
g++ -o output -Ipiduino_light -xc++ input/input.ino -Lpiduino_light -lpiduino
where output is your desired output program and input is your Arduino sketch.
2) Compiling Arduino sketches with MOVI library
Use:
g++ -o output -DRASPBERRYPI -I. -Ipiduino_light -xc++ input/input.ino -L. -Lpiduino_light -lmovi -lpiduino
where output is your desired output program and input is your Arduino sketch.
3) Extending Arduino sketches into "real" Raspberry Pi code
There is nothing stopping you from including Raspberry Pi specific include files and compiling against libraries installed in your system. If you feel you want your own main() method, then it's best to modify the piduinowrappter.cpp file. Also, renaming the .ino file into .cpp allows to remove the -xc++ flag.