Skip to content

ejovrh/MJ808

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

keywords:

Magicshine, bicycle front light, MJ808, MJ-808, MJ818, MJ-818, bicycle rear light, CAN bus, MCP2515, MCP2561

0. this all is still under development

front and rear lamps do work together and can be used on a bike. logic unit and auxiliary devices are still WIP.

1. abstract:

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.

2. light system topology (in ascii art)

== and || denote the CAN bus, power lines are omitted.

2.1 - current working setup

front and rear lights are interconnected via the CAN bus; the front light activates the rear light.

(front light) - (rear light)
------------------------------------------------
(mj808) ======  (mj818)

2.2 - WIP setup

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)

3. description of the original light

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.

4. motivation

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.

5. required software for building

  • 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.

6. repo structure

  • /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.

7. hardware

look in /datasheets/ for a complete lists of used hardware.

core components:

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.

8. software

8.1 general overview

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.

8.2 detailed description

TODO

Releases

No releases published

Packages

No packages published

Languages