Hello everyone,
I’m super excited to announce the first release of my passion project, Soleil!
What is Soleil?
Soleil is a power management and sleep control board for Raspberry Pi, specifically built for use with Nerves. It allows you to power your project from a battery, charge the battery with USB-C or a solar panel, and features a low-power mode to save battery. There are three wakeup sources so you can control exactly how and when your board powers on.
Additionally, Soleil has the ATECC608A chip (aka NervesKey) onboard to support secure connections to NervesHub.
And finally, the v0.2 board also features a Qwiic connector which allows you to easily plug into a huge ecosystem of third-party electronics. Soleil allows you to focus on building your portable or low-power project without worrying about how to power it.
Software
There is a Nerves system to support Soleil, as well as an Elixir driver library which includes convenience functions for interacting with the hardware.
Getting started is quite easy. From a new Nerves project, add the dependencies and target:
defmodule MyApp.MixProject do
use Mix.Project
@app :my_app
@version "0.1.0"
- @all_targets [:rpi3]
+ @all_targets [:soleil_rpi0_2]
# ...
defp deps do
[
# ...
- {:nerves_system_rpi3, "~> 1.29.1", runtime: false, targets: :rpi3},
+ {:soleil_system_rpi0_2, "~> 1.29.1", runtime: false, targets: :soleil_rpi0_2},
+ {:soleil, "~> 0.1.1", targets: @all_targets},
# ...
]
end
Then, in your config/target.exs
add the following config:
+ config :nerves_time, rtc: Soleil.MCP7940
Finally, add Soleil
to your application tree:
defmodule MyApp.Application do
def start(_type, _args) do
children =
[
# ...
+ {Soleil, battery_capacity: 2000, battery_energy: 7400},
] ++ children(Nerves.Runtime.mix_target())
opts = [strategy: :one_for_one, name: SoleilDemo.Supervisor]
Supervisor.start_link(children, opts)
end
end
The parameters battery_capacity
(in mAh) and battery_energy
(in mWh) depend on the battery you connect to the board. These values are used by the onboard fuel gauge chip to estimate the remaining battery life.
From here, you have access to all of the Soleil helper functions. You can read the battery info:
iex> {:ok, info} = Soleil.battery_info()
iex> info
%{
voltage: 3.82, # volts
current: 0.202, # amps
temperature: 29.34, # °C
state_of_charge: 82, # % battery remaining
}
To control the Soleil low power mode, you can use:
iex> Soleil.sleep_for(5, :hour)
:ok
iex> Soleil.sleep_until(~N[2026-01-01 00:00:00])
:ok
iex> Soleil.power_off()
:ok
On boot, it is often useful to know why Soleil woke up (was it a scheduled alarm, or a manual override?)
iex> Soleil.wakeup_reason()
:alarm
Customization
This project is completely open source with a permissive license. Not only do I want to share it, but I hope that people who need this type of power solution for their projects are enabled to modify the hardware themselves. That’s why, in v0.2 of the hardware, I have moved all of the components to the left side of the board, allowing for a significant open space for you to add your own sensors, connectors, etc.
The source files are available in GitHub, with a well-documented schematic. If you want to make changes, you can easily do so using KiCad, the open source PCB design software.
I will make a video about how to customize Soleil soon!
Project Next Steps
- If there is enough interest, I want to organize a group buy of the hardware for Q2 this year. I expect that the price would be around $30-35 USD + shipping. Fill out the waitlist form or send me a message to confirm your interest
- I am going to discuss more about Soleil (and open source hardware for Nerves in general) at the February edition of the online Nerves Meetup. This would be a good place to learn more about the project and ask questions (plus it is full of cool people!)
- I’m considering developing other variants of Soleil, such as a LoRa version or a weather station variant. If these interest you or you have other ideas, let me know!
- I think there’s a lot more interesting and useful projects for this model of open source hardware - stay tuned for more info soon
Links
Some of the resources for this project are spread across multiple repositories, so I want to list them all here:
Hardware:
Soleil Hardware
Hardware technical overview and schematic
Software:
soleil_system_rpi0_2 (hex)
soleil (hex)
soleil demo project
If you want to follow me, I post project updates on BlueSky: