Magicshine, bicycle front light, MJ808, MJ-808, MJ818, MJ-818, bicycle rear light, CAN bus, MCP2515, MCP2561
front and rear lamps do work together and can be used on a bike. logic unit and auxiliary devices are still WIP.
this undertaking is an attempt to redesign the MJ808/MJ818 lights by:
- designing a custom PCB w. driver/controller ICs,
- writing firmware the above controller IC,
- encapsulating the above in MJ808's/MJ818's original housing,
- combining:
- the rear light (MJ818),
- the front light (MJ808) and
- a control unit into an interconnected smart bicycle light system.
- developing further auxiliary devices which extend functionality of the lights.
== and || denote the CAN bus, power lines are omitted.
front and rear lights are interconnected via the CAN bus; the front light activates the rear light.
(front light) - (rear light)
------------------------------------------------
(mj808) ====== (mj818)
front and rear lights are extended in their functionality by other auxiliary devices interconnected via the CAN bus
(front light) - (control unit) - (rear light)
------------------------------------------------
(mj808) ====== (control unit) ====== (mj818)
|| ||
|| ||
|| (future device(s))
(dynamo)
google magicshine mj-818 / magicshine mj-808 for an idea what the lights are and look like.
these are decent made-in-china bicycle lights operated off a 2S2P Li-Lion battery pack.
their functionality, apart from producing light, sucks.
operating mode selection, strobing and high power consumption on the original lights is what i would like to have different.
the only reasonable way to achieve this is to start from scratch.
- eagle for PCB layout & schematics,
- atmel studio (or keil) for the code,
- atmel ICE or something similar,
- some cheapo arduino for quick and dirty CAN testing (the arduino acts as an improvised control unit) and
- SMD soldering equipment and skills.
- /datasheets/: contains what the name suggests,
- /dwg/: AutoCAD drawings & STLs of various sub-components,
- /eagle designs/: contains subfolders with eagle designs (.brd, .sch & BOMs) of various sub-components
- cos/: a dynamo thing, WIP,
- mj808/: the front light,
- mj818/: the rear light,
- mj828/: a small handlebar mounted UI (nothing fancy), WIP and
- drawings for the atmel ICE <-> light PCB programming adapter.
- /eagle libraries/: contains eagle libraries of electical components used.
- /gerber/: gerber files for PCB production,
- /MJ808/: C source code for everything.
look in /datasheets/ for a complete lists of used hardware.
core components:
- 4-layer PCB manufactured via OSH Park,
- Attiny4313 8bit microcontroller,
- MCP2515 CAN controller,
- MCP2561 CAN transciever,
- MAX16819 & MAX16820 LED drivers,
- LDK320 5V LDO,
- 0402 passives and
- Cree XM-L and XP-E high power LEDs.
when chosing components the primary criterium was size, since everything needed to fit into existing housings. maximizing light output to the extreme was not a design factor.
the language of choice is C, written in an object-oriented fashion:
- common core components translate into an abstract base class (implemented via C-structs),
- concrete implementations (e.g. mj808 ) translate into derived classes (again C-structs),
- methods are generally implemented via function pointers (e.g. CAN driver message operations),
- behaviour is sometimes achieved with OO interfaces,
- polymorphism is implemented manually via constructors (ctor in mj808_t) and
- information is hidden by nesting C-structs and placing them into either .c or .h files.
due to memory limitations there are only hints of SOLID and design patterns to be found.
code is commented in a reasonable manner.
TODO