Skip to content

Commit 1523f2a

Browse files
committed
added pre-built Armbian image
1 parent 66477f6 commit 1523f2a

File tree

9 files changed

+123
-63
lines changed

9 files changed

+123
-63
lines changed

GPIO-cable.sch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ GPS_Tx
6767
Text Label 5850 3100 0 50 ~ 0
6868
GPS_Rx
6969
Wire Notes Line
70-
3950 5000 7900 5000
70+
3950 5050 7900 5050
7171
Wire Notes Line
72-
7900 5000 7900 2700
72+
7900 5050 7900 2700
7373
Wire Notes Line
7474
7900 2700 3950 2700
7575
Wire Notes Line
76-
3950 2700 3950 5000
77-
Text Notes 6200 4900 0 50 ~ 0
76+
3950 2700 3950 5050
77+
Text Notes 5350 5000 0 79 ~ 0
7878
Orange Pi Zero <-> GPS and TFT cable
7979
Wire Wire Line
8080
4200 4100 4600 4100

Power-Splitter.sch

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ EELAYER 30 0
33
EELAYER END
44
$Descr A4 11693 8268
55
encoding utf-8
6-
Sheet 5 4
6+
Sheet 4 4
77
Title ""
88
Date ""
99
Rev ""
@@ -29,7 +29,7 @@ L Connector_Generic:Conn_01x03 J10
2929
U 1 1 65C488D1
3030
P 5300 3600
3131
F 0 "J10" V 5264 3412 50 0000 R CNN
32-
F 1 "Power Switch" V 5173 3412 50 0000 R CNN
32+
F 1 "Power Control" V 5173 3412 50 0000 R CNN
3333
F 2 "Connectors_JST:JST_XH_B03B-XH-A_03x2.50mm_Straight" H 5300 3600 50 0001 C CNN
3434
F 3 "~" H 5300 3600 50 0001 C CNN
3535
1 5300 3600
@@ -49,22 +49,22 @@ $EndComp
4949
$Comp
5050
L Connector_Generic:Conn_01x02 J12
5151
U 1 1 65C48BD5
52-
P 6850 3600
53-
F 0 "J12" V 6814 3412 50 0000 R CNN
54-
F 1 "Bias Tee" V 6723 3412 50 0000 R CNN
55-
F 2 "Connectors_JST:JST_XH_B02B-XH-A_02x2.50mm_Straight" H 6850 3600 50 0001 C CNN
56-
F 3 "~" H 6850 3600 50 0001 C CNN
57-
1 6850 3600
52+
P 6750 3600
53+
F 0 "J12" V 6714 3412 50 0000 R CNN
54+
F 1 "Bias Tee" V 6623 3412 50 0000 R CNN
55+
F 2 "Connectors_JST:JST_XH_B02B-XH-A_02x2.50mm_Straight" H 6750 3600 50 0001 C CNN
56+
F 3 "~" H 6750 3600 50 0001 C CNN
57+
1 6750 3600
5858
0 -1 -1 0
5959
$EndComp
6060
Wire Wire Line
6161
5200 3900 5200 3800
6262
Wire Wire Line
6363
5300 4050 5300 3800
6464
Wire Wire Line
65-
6950 3800 6950 4050
65+
6850 3800 6850 4050
6666
Wire Wire Line
67-
6950 4050 6300 4050
67+
6850 4050 6300 4050
6868
Wire Wire Line
6969
6300 3800 6300 4050
7070
Connection ~ 6300 4050
@@ -75,12 +75,12 @@ Wire Wire Line
7575
Wire Wire Line
7676
5400 3900 6200 3900
7777
Wire Wire Line
78-
6850 3900 6850 3800
78+
6750 3900 6750 3800
7979
Wire Wire Line
8080
6200 3800 6200 3900
8181
Connection ~ 6200 3900
8282
Wire Wire Line
83-
6200 3900 6850 3900
83+
6200 3900 6750 3900
8484
Text Label 4850 3900 0 50 ~ 0
8585
GND
8686
Wire Wire Line
@@ -100,8 +100,8 @@ $Comp
100100
L Jumper:Jumper_2_Open JP1
101101
U 1 1 65C4DC8A
102102
P 5000 4250
103-
F 0 "JP1" H 5000 4100 50 0000 C CNN
104-
F 1 "Jumper_2_Open" H 5000 4000 50 0000 C CNN
103+
F 0 "JP1" H 5000 4150 50 0000 C CNN
104+
F 1 "Bypass Jumper" H 5000 4050 50 0000 C CNN
105105
F 2 "Pin_Headers:Pin_Header_Straight_1x02_Pitch2.54mm" H 5000 4250 50 0001 C CNN
106106
F 3 "~" H 5000 4250 50 0001 C CNN
107107
1 5000 4250
@@ -117,4 +117,14 @@ Wire Wire Line
117117
Wire Wire Line
118118
5400 4250 5400 3900
119119
Connection ~ 5400 3900
120+
Wire Notes Line
121+
4500 3450 7350 3450
122+
Wire Notes Line
123+
7350 3450 7350 4550
124+
Wire Notes Line
125+
4500 4550 4500 3450
126+
Text Notes 6400 4450 0 79 ~ 0
127+
Power Splitter
128+
Wire Notes Line
129+
7350 4550 4500 4550
120130
$EndSCHEMATC

README.md

Lines changed: 82 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ display and the other devices.
2121
+ [Wiring](#wiring)
2222
- [Schematic](#schematic)
2323
- [Cable](#cable)
24+
- [Power Splitter](#power-splitter)
2425
* [Software](#software)
25-
+ [Armbian](#armbian)
26-
- [Custom Devive Tree Overlays](#custom-devive-tree-overlays)
27-
+ [Status LED](#status-led)
28-
+ [gpsd](#gpsd)
29-
+ [chrony](#chrony)
30-
+ [fbgpsclock](#fbgpsclock)
26+
+ [Pre-built OS Image](#pre-built-os-image)
27+
+ [Manual Configuration](#manual-configuration)
28+
- [Armbian](#armbian)
29+
- [Status LED](#status-led)
30+
- [gpsd](#gpsd)
31+
- [chrony](#chrony)
32+
- [fbgpsclock](#fbgpsclock)
3133
* [Links](#links)
3234

3335
## Hardware
@@ -57,8 +59,8 @@ display and the other devices.
5759
</a><br/>
5860
<em>side</em></p>
5961

60-
There's also [gallery __(NSFW)__](https://imgur.com/a/yd1e8r0) with some images
61-
from various stages of testing and building.
62+
There's also [a gallery __(NSFW)__](https://imgur.com/a/yd1e8r0) with some
63+
images from various stages of testing and building.
6264

6365
### Components
6466
#### Orange Pi Zero
@@ -163,9 +165,9 @@ More details are available at [moonbuggy/GPIO-power-switch][moonbuggy/GPIO-power
163165
<em>GPIO wiring</em></p>
164166

165167
#### Cable
166-
The specific pins chosen allow us to make a convenient cable to connect the GPS
167-
and TFT modules while leaving the I2C pins clear for the RTC module to plug
168-
directly in.
168+
The specific pins chosen allow us to make a convenient cable to connect the GPS,
169+
TFT and power control modules while leaving the I2C pins clear for the RTC
170+
module to plug directly in.
169171

170172
<p><a href="images/schematic-cable-2.0inch.png">
171173
<img src="images/schematic-cable-2.0inch.png" width="600">
@@ -191,8 +193,55 @@ The OPiZ end of the cable will attach to GPIO pins 11 to 26. Using a
191193
black wire for the ground connection to OPiZ pin 25 provides a convenient way to
192194
align the connector, regardless of the other wire colours.
193195

196+
#### Power Splitter
197+
<p><a href="images/schematic-splitter.png">
198+
<img src="images/schematic-splitter.png" width="600">
199+
</a><br/>
200+
<em>power splitter</em></p>
201+
202+
In an ideal world there'd be enough room in the enclosure to combine this
203+
splitter and the power control circuit on a single PCB, to save a cable run
204+
(although it's not a big deal that they're separate).
205+
206+
Closing the jumper bypasses the switch in the power control circuit, directly
207+
connecting the OPiZ and bias tee to ground, and is useful during testing. The
208+
button and LED in the power control circuit will still work as expected, and
209+
the MOSFET will still switch, it just won't have any effect and actually cut
210+
power after a <code>shutdown -h</code> command or button press.
211+
194212
## Software
195-
### Armbian
213+
### Pre-built OS Image
214+
There's a pre-built Armbian image at
215+
[moonbuggy/sbc-os-images](https://github.com/moonbuggy/sbc-os-images/releases/tag/Armbian-23.11.0-OPiZ-GPS-NTP)
216+
which will work out of the box for a build using the same (or compatible)
217+
hardware wired as described above. All the setup and configuration steps below
218+
have been done during the image creation.
219+
220+
Simply write the _*.img.xz_ file to an SD card, put the card in the OPiZ, power
221+
it up.
222+
223+
GPS devices other than the Neo M8N should work easily with this image, so long
224+
as they use _uart2_ (and use _pin 15_/_PA03_ for the PPS signal). A different
225+
display controller or RTC, however, would be incompatible with the device tree
226+
in the image.
227+
228+
It's possible to re-configure the pre-built OS after first boot, if necessary
229+
to adjust for differing hardware. Depending on how much modification is needed,
230+
it may be easier to start with a bare OS and do the manual steps described
231+
below.
232+
233+
#### Packages
234+
The _*.deb_ files in the release are packages which can be installed on top of
235+
an existing Armbian install, as an alternative to the pre-built image.
236+
237+
These packages just add the modules necessary for the GPIO power switch to work
238+
to the kernel. They do not install any GPS/NTP/TFT software or handle any of the
239+
configuration like the image does.
240+
241+
Install with: <code>sudo dpkg -i *.deb</code>
242+
243+
### Manual Configuration
244+
#### Armbian
196245
We need to enable the _i2c0_, _pps-gpio_, _tve_ and _uart2_ devices. It probably
197246
makes sense to enable _clock-1.2GHz-1.3v_ as well, if it isn't by default. This
198247
can be done in `armbian-config` or by editing _/boot/armbianEnv.txt_.
@@ -203,7 +252,7 @@ regardless of how the hardware overlays above are enabled:
203252
sudo sh -c "echo 'param_pps_pin=PA3' >> /boot/armbianEnv.txt"
204253
```
205254

206-
#### Custom Devive Tree Overlays
255+
##### Custom Devive Tree Overlays
207256
The device tree source (DTS) files in this repo for the display are for an
208257
ST7789V SPI TFT controller with a 240x280 or 240x320 display. They can be
209258
modified for other resolutions.
@@ -226,7 +275,7 @@ sudo armbian-add-overlay gpio-key-power.dts
226275
sudo armbian-add-overlay sun8i-h3-gpio-poweroff.dts
227276
```
228277

229-
##### Display Driver Init
278+
###### Display Driver Init
230279
Both DTS files contain a custom init for the driver. This init sequence is based
231280
off that in the kernel driver (as opposed to that in the ST7789V datasheet,
232281
which differs in some places), with only the _VSCSAD (37h): Vertical Scroll
@@ -250,27 +299,27 @@ The _240x320_ DTS is just using the kernel driver's default init unmodified. The
250299
`init` section probably doesn't need to be in this DTS, but it's a convenient
251300
reference for the defaults.
252301

253-
### Status LED
302+
#### Status LED
254303
If using the [moonbuggy/GPIO-power-switch][moonbuggy/GPIO-power-switch] module,
255304
the status LED can be changed from red to green to indicate the device is ready
256305
by pulling pin 16 (_PA19_) low. In this case we'll indicate 'ready' with a
257306
systemd service, once both the _gpsd_ and _chrony_ services are running.
258307

259-
##### /usr/lib/systemd/system/ready.target
308+
###### /usr/lib/systemd/system/ready.target
260309
```ini
261310
[Unit]
262311
Description=System is booted and ready (for toggling status LED)
263-
Requires=chrony.service gpsd.service gpsd.socket multi-user.target
264-
After=chrony.service gpsd.service gpsd.socket multi-user.target
312+
Requires=fbgpsclock.service chrony.service gpsd.service gpsd.socket multi-user.target
313+
After=fbgpsclock.service chrony.service gpsd.service gpsd.socket multi-user.target
265314
AllowIsolate=yes
266315
```
267316

268-
##### /usr/lib/systemd/system/ready-led.service
317+
###### /usr/lib/systemd/system/ready-led.service
269318
```ini
270319
[Unit]
271320
Description='ready' status indicator LED
272-
After=chrony.service gpsd.service gpsd.socket
273-
Requires=chrony.service gpsd.service gpsd.socket
321+
After=fbgpsclock.service chrony.service gpsd.service gpsd.socket
322+
Requires=fbgpsclock.service chrony.service gpsd.service gpsd.socket
274323

275324
[Service]
276325
Type=oneshot
@@ -289,18 +338,18 @@ sudo systemctl enable ready-led
289338
sudo systemctl set-default ready.target
290339
```
291340

292-
### gpsd
293-
#### Installation
341+
#### gpsd
342+
##### Installation
294343
```sh
295344
sudo apt install gpsd
296345

297346
# optional tools
298347
sudo apt install gpsd-tools pps-tools
299348
```
300349

301-
##### /etc/default/gpsd
350+
###### /etc/default/gpsd
302351
```ini
303-
# Devices gpsd should collect to at boot time.
352+
# Devices gpsd should connect to at boot time.
304353
# They need to be read/writeable, either by user gpsd or the group dialout.
305354
DEVICES="/dev/ttyS2 /dev/pps0"
306355

@@ -326,13 +375,13 @@ sudo systemctl enable gpsd
326375
sudo systemctl start gpsd
327376
```
328377

329-
### chrony
330-
#### Installation
378+
#### chrony
379+
##### Installation
331380
```sh
332381
sudo apt install chrony
333382
```
334383

335-
##### /etc/chrony/conf.d/gpsd.conf
384+
###### /etc/chrony/conf.d/gpsd.conf
336385
```ini
337386
refclock SHM 0 refid NMEA offset 0.110
338387
refclock PPS /dev/pps0 refid PPS lock NMEA
@@ -347,7 +396,7 @@ The default configuration for the RTC is for chrony to tell the system to set it
347396
every 11 minutes. To let chrony set the time from the RTC (as a backup if
348397
there's some issue with the GPS), it needs to be run with the `-s` argument.
349398

350-
##### /etc/default/chrony
399+
###### /etc/default/chrony
351400
```sh
352401
# This is a configuration file for /etc/init.d/chrony and
353402
# /lib/systemd/system/chrony.service; it allows you to pass various options to
@@ -357,7 +406,7 @@ there's some issue with the GPS), it needs to be run with the `-s` argument.
357406
DAEMON_OPTS="-F 1 -r -m -s"
358407
```
359408

360-
### fbgpsclock
409+
#### fbgpsclock
361410
The [fbgpsclock][moonbuggy/fbgpsclock] repo contains software for displaying
362411
time and GPS information on the TFT display.
363412

@@ -366,7 +415,7 @@ time and GPS information on the TFT display.
366415
</a><br/>
367416
<em>fbgpsclock screenshot</em></p>
368417

369-
#### Installation
418+
##### Installation
370419
Check build dependencies are installed (this may not be a complete dependency
371420
list):
372421
```sh
@@ -388,6 +437,7 @@ More detail and configuration information is available at [moonbuggy/fbgpsclock]
388437
## Links
389438
### Software
390439
* [moonbuggy/fbgpsclock][moonbuggy/fbgpsclock]
440+
* [moonbuggy/sbc-os-images][moonbuggy/sbc-os-images]
391441

392442
### Hardware
393443
* [moonbuggy/GPIO-power-switch][moonbuggy/GPIO-power-switch]
@@ -398,4 +448,5 @@ More detail and configuration information is available at [moonbuggy/fbgpsclock]
398448
* [ST7789V](https://newhavendisplay.com/content/datasheets/ST7789V.pdf)
399449

400450
[moonbuggy/fbgpsclock]: https://github.com/moonbuggy/fbgpsclock
451+
[moonbuggy/sbc-os-images]: https://github.com/moonbuggy/sbc-os-images
401452
[moonbuggy/GPIO-power-switch]: https://github.com/moonbuggy/GPIO-power-switch

images/enclosed-rear.jpg

207 KB
Loading

images/schematic-splitter.png

23.2 KB
Loading

overlays/sun8i-h3-gpio-poweroff.dts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
/dts-v1/;
22
/plugin/;
33

4-
/* This overlay will pull a pin high to signal the OS has shutdown and
5-
it's safe to cut power to the board (and the rest of the enclosure).
4+
/* This overlay will pull a pin high to signal the OS has shutdown and it's safe
5+
to cut power to the board (and the rest of the enclosure).
66

7-
Pulling high on shutdown is better than pulling low because once
8-
power has been cut the high signal will fall back to low. This means
9-
an SR latch won't have behave in an undefined manner when a "power
10-
on" button is pressed to restore power to the enclosure, as the
11-
"power off" signal will clear itself.
7+
Pulling high on shutdown is better than pulling low because once power has
8+
been cut the high signal will fall back to low. This means an SR latch won't
9+
behave in an undefined manner when a "power on" button is pressed to restore
10+
power to the enclosure, as the "power off" signal will clear itself.
1211

13-
CONFIG_POWER_RESET_GPIO and CONFIG_POWER_RESET_GPIO_RESTART need to
14-
be enabled in the kernel for this to work.
12+
CONFIG_POWER_RESET_GPIO and CONFIG_POWER_RESET_GPIO_RESTART need to be
13+
enabled in the kernel for this to work.
1514

1615
See: https://www.kernel.org/doc/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt
1716
*/

root/etc/default/gpsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Devices gpsd should collect to at boot time.
1+
# Devices gpsd should connect to at boot time.
22
# They need to be read/writeable, either by user gpsd or the group dialout.
33
DEVICES="/dev/ttyS2 /dev/pps0"
44

root/usr/lib/systemd/system/ready-led.service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Unit]
22
Description='ready' status indicator LED
3-
After=chrony.service gpsd.service gpsd.socket
4-
Requires=chrony.service gpsd.service gpsd.socket
3+
After=fbgpsclock.service chrony.service gpsd.service gpsd.socket
4+
Requires=fbgpsclock.service chrony.service gpsd.service gpsd.socket
55

66
[Service]
77
Type=oneshot
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[Unit]
22
Description=System is booted and ready (for toggling status LED)
3-
Requires=chrony.service gpsd.service gpsd.socket multi-user.target
4-
After=chrony.service gpsd.service gpsd.socket multi-user.target
3+
Requires=fbgpsclock.service chrony.service gpsd.service gpsd.socket multi-user.target
4+
After=fbgpsclock.service chrony.service gpsd.service gpsd.socket multi-user.target
55
AllowIsolate=yes

0 commit comments

Comments
 (0)