- Analog to digital signal conversion:
- Engine speed signal for 1, 2, 3, or 4 cylinders.
- Speed signal from a bridge inductive sensor or Hall sensor.
- Settings for km/h or mph, wheel circumference, number of pulses per revolution.
- Various indicators:
- Neutral indicator.
- Gear position indicator for gears 1 to 6.
- Fuel reserve indicator.
- Low battery indicator.
- Turn signal indicator (right, left, hazard).
- High beam indicator.
- Position lights indicator.
- ABS indicator.
- Temperature indicator.
- Oil pressure indicator.
- Choke indicator.
- Stop control indicator.
- Fuel level gauge.
- Multi-screen display (4 screens).
- Relay controls:
- On/off relay control.
- Timed relay control.
dashboard on Youtube
Attached is a Windows x64 and x86 application designed to simulate sending data from a PC to a smartphone. Configure your PC's Bluetooth LE to use port 1 to 5 and rename it to 'AEON'. You can then connect your phone to the 'AEON' SSID. Using the simulator you will be able to send data to your phone. If your computer does not have Bluetooth LE you must purchase a USB Bluetooth 4.0 HM-10 or BT-09 compatible adapter
DASHBOARD_SIMULATOR_x64
DASHBOARD_SIMULATOR_x86
Simplified B4A script for demonstrations
AEON DASHBOARD Android
AEON DASHBOARD iOS
Simplified B4A script for demonstrations:
'' This script was written to demonstrate the Bluetooth Low Energy connection with the
'' AEON electronic interface or with PC simulation software. It is intended to provide
'' useful information for the development of various graphics applications in line with
'' the AEON product.
'' Written by André FAËS (Mr Blue Sky)
#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=BLEExample.zip
' Class declaration and initialization of global variables
' defines variables used across the class, including UI elements
' like buttons and gauges, and managers for BLE services and execution permissions.
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private manager As BleManager2
Private rp As RuntimePermissions
Dim PO As PhoneOrientation
Private pnlLayout As Panel
Private btnDisconnect As B4XView
Private btnScan As B4XView
Private lblDeviceStatus As B4XView
Private currentStateText As String = "UNKNOWN"
Private currentState As Int
Private connected As Boolean = False
Private ConnectedName As String = "AEON"
Private ConnectedServices As List
Private pbScan As B4XLoadingIndicator
Private xSpeedGauge As xGauges
Private xFuelGauge As xGauges
Private xTiltGauge As xGauges
Private xRPMGauge As xGauges
Private fntTANK, fntOIL, fntTEMP, fntBATT, fntCHOKE, fntBREAK, fntABS, fntDEFAULT, fntLEFT, fntRIGHT, fntLOWBEAM, fntHIGHBEAM As B4XView
Private lblGear, lblODO, lblTRIP As Label
Private bt_trip As B4XView
Private dialog As B4XDialog
Private speedview As SnakeView
Dim bmpSpeedview As BitmapDrawable
End Sub
' Method provided for initializing additional components or databases if necessary, currently commented
Public Sub Initialize
' If dBSQL.IsInitialized = False Then
' InitdbSQL
' End If
End Sub
' Load the main layout, initialize the dialog, BLE manager, configure gauges,
' start listening for device orientation, and configure policies and colors.
' Each of these methods initializes a specific part of the application,
' such as panel settings, dialogs, handlers, gauges, etc.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("main")
InitializePanelSettings
InitializeDialog
InitializeManager
ConfigureGauges
StartDeviceOrientationListening
ConfigureFontsAndColors
End Sub
' Configures initial interface panel settings, such as button visibility.
Private Sub InitializePanelSettings
pnlLayout.SetLayout(0, 0, pnlLayout.Width, pnlLayout.Height)
pnlLayout.Visible=True
btnScan.Visible = True
btnDisconnect.Visible = False
End Sub
' Initializes the dialog with a specific title
Private Sub InitializeDialog
dialog.Initialize(Root)
dialog.Title = "AEON 4.0 Setting"
End Sub
' Initializes the BLE manager and updates the initial connection state
Private Sub InitializeManager
manager.Initialize("manager")
StateChanged
End Sub
' Updates interface elements based on BLE connection status
Public Sub StateChanged
If connected Then
lblDeviceStatus.Text = "Connected: " & ConnectedName
manager.ReadData2(UUID("FFE0"), UUID("FFE1"))
Sleep(1000)
btnScan.Visible = False
btnDisconnect.Visible = True
manager.SetNotify(UUID("FFE0"), UUID("FFE1"),True)
Else
lblDeviceStatus.Text = "Not connected"
btnScan.Visible = True
btnDisconnect.Visible = False
End If
btnDisconnect.Enabled = connected
btnScan.Enabled = Not(connected)
pbScan.Hide
btnScan.Enabled = (currentState = manager.STATE_POWERED_ON) And connected = False
End Sub
' Configures gauges with initial values and visualization settings.
Private Sub ConfigureGauges
Dim initialSpeedValues As List = Array(60, 60, 90, 100, 70, 150, 240, 260)
xSpeedGauge.Value = 0
xFuelGauge.Value = 0
xTiltGauge.Value = 60
xRPMGauge.Value = 0
bmpSpeedview.Initialize(LoadBitmap(File.DirAssets, "backspeedchart.png"))
speedview.StrokeColor = Colors.Red
speedview.MaximumNumberOfValues = 10
speedview.MaxValue = 260
speedview.MinValue = 0
For Each value As Int In initialSpeedValues
speedview.addValue(value)
Next
End Sub
Private Sub StartDeviceOrientationListening
PO.StartListening("PO")
End Sub
Private Sub ConfigureFontsAndColors()
Dim fonts As List = Array(fntTANK, fntOIL, fntTEMP, fntBATT, fntCHOKE, fntBREAK, fntABS, fntLEFT, fntRIGHT, fntLOWBEAM, fntHIGHBEAM, fntDEFAULT)
For Each fnt As B4XView In fonts
fnt.Font = xui.CreateFont(Typeface.CreateNew(Typeface.LoadFromAssets("fiveaces.ttf"), Typeface.STYLE_NORMAL), fnt.TextSize)
fnt.TextColor = xui.Color_Gray
fnt.Color = xui.Color_Transparent
Next
Dim labelTexts As Map = CreateMap(fntTANK: "E", fntOIL: "F", fntTEMP: "K", fntBATT: "C", fntCHOKE: "H", fntBREAK: "D", fntABS: "B", fntLEFT: "L", fntRIGHT: "M", fntLOWBEAM: "A", fntHIGHBEAM: "G", fntDEFAULT: "D")
For Each key As B4XView In labelTexts.Keys
key.Text = labelTexts.Get(key)
Next
End Sub
' Handles the click of the scan button, checking the necessary permissions before starting the scan.
Sub btnScan_Click
Dim Permissions As List
Dim phone As Phone
If phone.SdkVersion >= 31 Then
Permissions = Array("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT", rp.PERMISSION_ACCESS_FINE_LOCATION)
Else
Permissions = Array(rp.PERMISSION_ACCESS_FINE_LOCATION)
End If
For Each per As String In Permissions
rp.CheckAndRequest(per)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
ToastMessageShow("No permission: " & Permission, True)
Return
End If
Next
pbScan.Show
StartScan
End Sub
Public Sub StartScan
If manager.State <> manager.STATE_POWERED_ON Then
Log("Bluetooth is not powered on.")
Return
End If
CheckBluetoothPermissions
manager.Scan2(Array(UUID("FFE0")), False)
End Sub
Private Sub CheckBluetoothPermissions()
Dim Permissions As List = Array("android.permission.BLUETOOTH_SCAN", "android.permission.BLUETOOTH_CONNECT", rp.PERMISSION_ACCESS_FINE_LOCATION)
For Each Permission As String In Permissions
rp.CheckAndRequest(Permission)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If Result = False Then
xui.MsgboxAsync("Permission denied: " & Permission, "Error")
Return
End If
Next
End Sub
' Manage events related to BLE device discovery.
Sub Manager_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
Log("Found: " & Name & ", " & Id & ", RSSI = " & RSSI & ", " & AdvertisingData) 'ignore
' If Id = "68:E7:4A:EB:EA:BB" Then
If Name = "AEON" Then
ConnectedName = Name
manager.StopScan
Log("connecting")
manager.Connect2(Id, False) 'disabling auto connect can make the connection quicker
End If
End Sub
' Manage events related to Bluetooth state changes.
Sub Manager_StateChanged (State As Int)
Select State
Case manager.STATE_POWERED_OFF
currentStateText = "POWERED OFF"
Case manager.STATE_POWERED_ON
currentStateText = "POWERED ON"
Case manager.STATE_UNSUPPORTED
currentStateText = "UNSUPPORTED"
End Select
currentState = State
StateChanged
End Sub
' Handles the click of the BLE device disconnect button
Sub btnDisconnect_Click
manager.Disconnect
Manager_Disconnected
End Sub
Sub btnReadData_Click
For Each s As String In ConnectedServices
manager.ReadData(s)
Next
End Sub
' Processes data received via BLE, decrypting received messages and triggering appropriate processing.
Sub Manager_DataAvailable (ServiceId As String, Characteristics As Map)
Dim BC As ByteConverter
For Each id As String In Characteristics.Keys
Dim b() As Byte = Characteristics.Get(id)
Dim GetHexString As String = BC.HexFromBytes(b)
' Log original hex string
Log("Trame reçue: " & GetHexString)
' Split the received string into valid messages
Dim messages() As String = Regex.Split("0D0A", GetHexString)
For Each msg As String In messages
If msg.Length > 0 Then ' Check to ensure non-empty
Dim validMsg As String = msg & "0D0A" ' Append back the split pattern to each valid message
'Log("Individual frame: " & validMsg)
If validMsg.EndsWith("0D0A") Then
HandleCharacteristic(validMsg)
Else
' Log("Invalid or incomplete individual frame")
End If
End If
Next
Next
End Sub
' These methods break down and process specific BLE messages received,
' adjusting gauge values and displaying device data like speed, battery status, etc.
Sub HandleCharacteristic(GetHexString As String)
' Vérifiez la longueur et l'intégrité de base de GetHexString
If GetHexString.EndsWith("0D0A") Then
' Cuts the frame according to the specific requirements of each message
Select Case True
Case GetHexString.Length = 20 ' For the majority of cases
ProcessMessage(GetHexString)
Case GetHexString.Length = 24 ' Specific case, as for ODO
If GetHexString.SubString2(8, 12) = "0032" Then
lblODO.Text = "ODO : " & Bit.ParseInt(GetHexString.SubString2(12, 20), 16)
' dBSQL.ExecNonQuery("UPDATE counter_set set mileage ='"& Bit.ParseInt(GetHexString.SubString2(12, 20), 16) &"' WHERE ID = 1" )
End If
Case Else
Log("Unmanaged or incorrect frame length: " & GetHexString)
End Select
Else
Log("Corrupted or incomplete frame: " & GetHexString)
End If
End Sub
' These methods break down and process specific BLE messages received,
' adjusting gauge values and displaying device data like speed, battery status, etc.
Sub ProcessMessage(GetHexString As String)
Dim functionCode As String = GetHexString.SubString2(8, 12)
Dim value As String = GetHexString.SubString2(12, 16)
Select Case functionCode
Case "0010" 'SPEED
Dim speedValue As Int = Bit.ParseInt(value, 16)
xSpeedGauge.Value = speedValue
speedview.addValue(speedValue)
Case "0021" 'TRIP
lblTRIP.Text = "TRIP : " & Bit.ParseInt(value, 16)
Case "0050" 'GEAR
Select Case Bit.ParseInt(value, 16)
Case 0
lblGear.TextColor=xui.Color_Green
lblGear.Text = "N"
Case 1
lblGear.TextColor=xui.Color_ARGB(255,249,180,121)
lblGear.Text = "1"
Case 2
lblGear.TextColor=xui.Color_ARGB(255,249,180,121)
lblGear.Text = "2"
Case 3
lblGear.TextColor=xui.Color_ARGB(255,249,180,121)
lblGear.Text = "3"
Case 4
lblGear.TextColor=xui.Color_ARGB(255,249,180,121)
lblGear.Text = "4"
Case 5
lblGear.TextColor=xui.Color_ARGB(255,249,180,121)
lblGear.Text = "5"
Case 6
lblGear.TextColor=xui.Color_ARGB(255,249,180,121)
lblGear.Text = "6"
Case Else
' This case might never be reached due to the above modulo operation
End Select
Case "0100" 'RPM
xRPMGauge.Value = Round(Bit.ParseInt(value, 16)/21.25)
Case "0110" 'free
'***********************
Case "0111" 'DEFAULT
If Bit.ParseInt(value, 16) = 1 Then
fntDEFAULT.TextColor=xui.Color_Red
Else
fntDEFAULT.TextColor=xui.Color_Gray
End If
Case "0112" 'RIGHT
If Bit.ParseInt(value, 16) = 1 Then
fntRIGHT.TextColor=xui.Color_Green
Else
fntRIGHT.TextColor=xui.Color_Gray
End If
Case "0113" 'LEFT
If Bit.ParseInt(value, 16) = 1 Then
fntLEFT.TextColor=xui.Color_Green
Else
fntLEFT.TextColor=xui.Color_Gray
End If
Case "0114" 'HBEAM
If Bit.ParseInt(value, 16) = 1 Then
fntHIGHBEAM.TextColor=xui.Color_Blue
Else
fntHIGHBEAM.TextColor=xui.Color_Gray
End If
Case "0115" 'LBEAM
If Bit.ParseInt(value, 16) = 1 Then
fntLOWBEAM.TextColor=xui.Color_Yellow
Else
fntLOWBEAM.TextColor=xui.Color_Gray
End If
Case "0116" 'ABS
If Bit.ParseInt(value, 16) = 1 Then
fntABS.TextColor=xui.Color_ARGB(255,249,180,121)
Else
fntABS.TextColor=xui.Color_Gray
End If
Case "0117" 'OIL
If Bit.ParseInt(value, 16) = 1 Then
fntOIL.TextColor=xui.Color_Red
Else
fntOIL.TextColor=xui.Color_Gray
End If
Case "0118" 'FUEL
If Bit.ParseInt(value, 16) = 1 Then
fntTANK.TextColor=xui.Color_ARGB(255,249,180,121)
Else
fntTANK.TextColor=xui.Color_Gray
End If
Case "0119" 'CHOKE
If Bit.ParseInt(value, 16) = 1 Then
fntCHOKE.TextColor=xui.Color_Yellow
Else
fntCHOKE.TextColor=xui.Color_Gray
End If
Case "0120" 'TEMP
If Bit.ParseInt(value, 16) = 1 Then
fntTEMP.TextColor=xui.Color_Red
Else
fntTEMP.TextColor=xui.Color_Gray
End If
Case "0121" 'BATTERY
If Bit.ParseInt(value, 16) = 1 Then
fntBATT.TextColor=xui.Color_Red
Else
fntBATT.TextColor=xui.Color_Gray
End If
Case "0122" 'METRIC
If Bit.ParseInt(value, 16) = 1 Then
xSpeedGauge.GaugeUnit="mph"
Else
xSpeedGauge.GaugeUnit="km/h"
End If
Case "0123" 'GAUGE %
Case "0130" 'FUEL GAUGE
xFuelGauge.Value = Round(Bit.ParseInt(value, 16) * (21/255)) 'value * 21 / 255
Case "0140" 'TEMP GAUGE
'
Case Else
' This case might never be reached due to the above modulo operation
End Select
End Sub
' Calls the 'StateChanged' method to update the UI to reflect the disconnected state.
Sub Manager_Disconnected
Log("Disconnected")
connected = False
StateChanged
End Sub
' Calls the 'StateChanged' method to update the UI to reflect the connected state.
Sub Manager_Connected (services As List)
Log("Connected")
connected = True
ConnectedServices = services
Log(services)
StateChanged
End Sub
'utility to convert short UUIDs to long format on Android
Private Sub UUID(id As String) As String 'ignore
Return "0000" & id.ToLowerCase & "-0000-1000-8000-00805f9b34fb"
End Sub
' Handles button click related to trips/trips, writes specific data via BLE if connected.
Private Sub bt_trip_Click
If lblDeviceStatus.Text = "Not connected" Then
Message
Else
manager.WriteData(UUID("FFE0"), UUID("FFE1"),Array As Byte(0xF3))
lblTRIP.Text = "ODO : 0"
End If
End Sub
private Sub Message
xui.MsgboxAsync("You must be paired with the AEON interface to be able to communicate with it","")
End Sub
' Updates the tilt gauge based on changes in device orientation.
Sub PO_OrientationChanged(Azimuth As Float, Pitch As Float, Roll As Float)
xTiltGauge.Value = 60 - Pitch
End Sub
Last edited: