[ad_1]
[Jacob Geigle] had a problem. A GPS unit and a Bluetooth-to-serial have been tying up all the hardware UARTs on an AVR Arduino project. “Software serial”, I hear you say. But what if I informed you [Jacob] currently experienced the board in concern sending out info above CAN bus?
[Jacob]’s sweet hack creates an arbitrary selection of CAN “devices” inside of the Arduino code, and can handle each individual a person of them as its have serial knowledge channel. The “N” in CAN stands for community, just after all. The trick is to create a machine ID for each ideal CANSerial interface, which is carried out in his library making use of the normal Arduino setup stage. A buffer normally takes care of storing all the distinctive channels right up until they can be pushed out in excess of the hardware CAN peripheral. On the massive-laptop aspect of matters, some application listens for the different “device” enumeration IDs and assigns each and every a virtual serial port.
Although this was a hack born of necessity, we can see it as a intelligent prospect to segregate information and facts coming from the microcontroller into distinctive streams. Perhaps a debug channel, a command channel, and a details channel? They’re virtual products, so go nuts!
Though we generally see CANbus in its native habitat – inside your auto – it is also interesting to consider of the takes advantage of we could place it to. For instance, managing a 3D printer. Will need a CAN refresher? We have bought just the ticket.
[Bus photo: Malta Bus; The terminus, Valletta by John Haslam. Can photo: Paint Cans by Daniel R. Blume. Horrible visual pun: I’m afraid that’s on us. You try finding images for CANbus code!]
[ad_2]
Supply hyperlink