Soleil: open source power management hardware for Nerves

Hello everyone,

I’m super excited to announce the first release of my passion project, Soleil! :tada:

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 :slight_smile:
  • 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 :eyes:

Links

Some of the resources for this project are spread across multiple repositories, so I want to list them all here:

Project homepage

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:

25 Likes

This looks really great, nice work!

2 Likes

Thank you! I appreciate the kind words :smile:

This looks like exactly what I will be needing in Q2! I have signed up.

(BTW, any chance you could fedibridge (https://fed.brid.gy/) your bsky account?

1 Like

Extremely nice, well done!

Do you plan on shipping them personally or you found a distribution channel?

Thank you! I should be bridged now? @gworkman.bsky.social@bsky.brid.gy

I’m not really looking to sell these at commercial scale, more so just to provide a piece of open hardware to the community for developing low-power Nerves applications. I would likely use a platform like Lectronz or Tindie to do payment processing/sales, but I would ship them myself from Luxembourg :slight_smile: I’m not planning to make a profit with these, just to cover the costs of production

1 Like

Ah, by looking at your profile I thought you are currently in US, if you are in Europe this makes things much easier.

1 Like

Ah, I haven’t updated my profile in a while. I used to be in US, currently located in Europe! And I’ll be at ElixirConf EU this year

1 Like

Following. Thanks!

Really cool! Also, great timing with the other poster @cblavier who was asking about power management.

@gus if you’d be interested in authoring a short project-based book like: Build a Binary Clock with Elixir and Nerves: Use Layering to Produce Better Embedded Systems by Frank Hunleth and Bruce A. Tate
and
Build a Weather Station with Elixir and Nerves: Visualize Your Sensor Data with Phoenix and Grafana by Alexander Koutmos, Bruce A. Tate, Frank Hunleth
that focuses on a project that uses Soleil, hit me up: margaret.eldridge@pragprog.com. Both are modest sellers, but I think the readers who bought those books really enjoyed them.

3 Likes