Coronium ACE Pi¶
Coronium ACE Pi is the communication channel between your RPi device and client, allowing you to quickly build lightweight APIs to control your RPi.
Coronium ACE Pi (acepi) is available for installation on Raspbian Jessie, running on a Raspberry Pi version 1B or better.
Differences from ACE¶
-
ACE Pi is aimed at the Raspberry Pi (RPi) small form factor "computer". Specifically the Raspbian Jessie Linux distribution.
-
The
ace
card is called asacepi
on the Raspberry Pi devices. -
The 'app' path on the Raspberry Pi is /home/pi/Ace/app.
-
Coronium ACE Pi is not Docker based, and installs on the Raspbian OS directly.
-
There is only a single 'app' instance, but you can create as many modules as your sdcard can hold.
-
12 additional namespaces relevant to the Raspberry Pi and low-level system tools have been added.
-
The lpeg library has been added, which allows you to easily parse system data.
ACE Pi Installation¶
This is a development version of Coronium ACE Pi and should be installed separate of your main card while playing.
For best results, a fresh sdcard install with Raspbian Jessie is highly recommended and will be assumed in the upcoming steps.
Preflight
Install a current version of Raspbian Jessie OS on your Raspberry Pi 1b or 2 device.
Click Here for Raspbian Installation Options
Note
Use NOOBS if you're new to installing Raspbian on the RPi, though using an image is about 5 times faster.
Initial setup
When you first boot to the Raspbian UI, in the upper-left, select Menu > Preferences > Raspberry Pi Configuration
- Click Change Password to update the password.
- In Hostname enter
ace-pi
(or something). - In The Boot section, select "To CLI".
- In Auto login, uncheck "Login as user 'pi'"
- Click "OK".
- Reboot when prompted.
raspi-config
Your RPi will reboot into terminal mode (no more UI). The UI takes up precious RAM, and we really don't need a full OS UI for ACE Pi. If you are running a RPi 1b, you can't run Ace and the UI at the same time without serious performance degradation.
- At the login prompt enter: pi.
- Enter whatever password you created at first launch.
Once you are logged in, you should perform the following "tweaks" to the system.
First run the raspi-config
tool:
sudo raspi-config
Once the config tool loads you will see many different options. Make changes to the following:
Tip
You can ignore any warnings that pop up. It all works itself out in the end.
Required
- Expand Filesystem (Will update on next reboot)
- Advanced Options > Memory Split : Set to "16"
- Internationalisation Options > Change Locale : User choice (UTF-8 is best)
- Internationalisation Options > Change Timezone : User choice
- Internationalisation Options > Change Keyboard Layout : User choice
- Advanced Options > SPI : Enable (at 'autoload' prompt: "yes")
- Advanced Options > I2C : Enable (at 'autoload' prompt: "yes")
Optional
- Enable Camera
- Overclock
Reboot when prompted.
Install Redis
- After the system reboots login with pi.
- Password should be what you set earlier in the setup.
sudo apt-get update
sudo apt-get install -y redis-server
ACE Pi Installation
Coronium ACE Pi is easily installed as a Debian package.
wget https://s3.amazonaws.com/coronium-ace/rpi/coronium-ace-rpi.deb
sudo dpkg -i coronium-ace-rpi.deb
Your new instance can be found at /home/pi/Ace
Module Development
Your modules should be placed in /home/pi/Ace/app
The port that the ACE Pi service runs on is 8081
ACEPi Card
You can manage your ACE Pi instance by using the acepi
tool:
acepi
Add the rpi
test module.
acepi add rpi
Point your browser to your.rpi_domain_or_ip:8081/rpi/temp
You should see the Raspberry Pi temperature output to the page. Browse this code and other methods in the /home/pi/Ace/app/rpi/api.lua file.
Uninstall ACE Pi
sudo dpkg -r coronium-ace-rpi
Uninstall Redis-Server
sudo apt-get remove redis-server
Note
Any files added to the Ace Pi installation will not be removed by the uninstaller. This protects your added modules from accidental deletion.
Additional Modules¶
Coronium ACE Pi comes with some extra API tools for interacting with the RPi hardware, and includes the following additional modules:
Module | Details |
---|---|
Periphery | A Lua library that provides access to GPIO, SPI, I2C, MMIO, and Serial interfaces. |
ljsyscall | Unix system calls for LuaJIT. Usage requires some code diving. |
lpeg | Parsing Expression Grammars For Lua. Next generation regex. |
In addition to the main Ace library, The following namespaces are available on the Raspberry Pi to use in your Lua code as well:
lpeg
- ace.lpeg
Periphery
- ace.gpio
- ace.i2c
- ace.mmio
- ace.spi
- ace.serial
RPi Userland
- ace.vccmd
Unix syscall
- ace.sys
- ace.sys.utils
- ace.sys.nl
System Command
- ace.cmd
Learn more about module usage in the API docs.
Troubleshooting¶
Start the Instance
Check to make sure the ACE Pi instance is running by logging into the RPi and issuing the following command, then checking for the "status" text.
acepi
If your instance is stopped, then issue the following:
acepi start
It should now be in a running state. Run acepi h
for more control options.
Accessing ACE Pi
Your API entrypoint can be found at: your.rpi_domain_or_ip:8081
Call an API endpoint: your.rpi_domain_or_ip:8081/echo/test?hello=Pi
Logs, Modules and More
You can view all the ACE Pi options available by entering:
acepi help
#OR
acepi h
Coronium ACE Library
In addition to the ACE Pi modules, you also have access to all the base Coronium Ace API modules.