Upated wrong readme file

This commit is contained in:
NicoHood 2015-08-09 14:41:38 +02:00
parent bec08597f1
commit 8de97930b7

381
Readme.md
View file

@ -1,232 +1,225 @@
MSGEQ7 Library 1.2 + Board v1.0
===============================
![Header](header.png)
Arduino HID Project 2.4
=======================
The MSGEQ7 is an IC designed to analyze music on different frequencies.
This library reads the MSGEQ7 with 7 different frequencies from range 0-255, stereo or mono.
It can be used to visualize audio through Leds for example.
This repository also includes the source of an [Breakout Board](https://github.com/NicoHood/MSGEQ7/tree/dev#breakout-board).
![Header Picture](header.jpg)
The frequencies are:
63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25KHz, 16kHz
This project went through a lot of phases and has now reached a new Arduino ~~USB-Core~~ Library
with a lot of new functions like extended HID. It also supports HoodLoader1+2.
The idea is to enable enhanced USB functions to almost all 'standard' Arduino boards.
####Features
* IDE 1.6.x with every Arduino compatibly
* [Sparkfun Spectrum Shield](https://www.sparkfun.com/products/13116) compatible
* Reads 1-n MSGEQ7 sensors
* Compact and fast implementation
* More compact and flexible 8 bit resolution
* Optional 10 bit resolution
* Value smoothing
* Tools to reduce noise
* A [Breakout Board](https://github.com/NicoHood/MSGEQ7/tree/dev#breakout-board).
####Examples included:
* Led: blinks led, shows basic usage
* Serial: shows spectrum via serial and how to use more channels
* FastLED: blinks led strip with different frequencies. Shows how to use different syntax.
Uses [FastLED library](https://github.com/FastLED/FastLED)
More projects/contact:
http://www.NicoHood.de
See the [wiki](https://github.com/NicoHood/HID/wiki/Features) for more information about features etc.
Hardware Setup
==============
To use the MSGEQ7 you first need a few other parts and connect them properly.
Make sure the 33pF capacitor and the 200k Ohm resistor are precise.
Otherwise the frequencies may be off.
See the [data sheet](https://www.sparkfun.com/datasheets/Components/General/MSGEQ7.pdf) for more information.
Download
========
#####Required parts (stereo):
* 2x [MSGEQ7 IC](https://www.sparkfun.com/products/10468)
* 1x [Audio Jack 3.5mm](https://www.sparkfun.com/products/8032) (or any other audio input)
* 2x 10nF Capacitor
* 4x 100nF Capacitor
* 2x 33pF Capacitor
* 2x 200k Ohm Resistor
* Led or Led strips
* 1x 220 Ohm Resistor (for Led)
###Breadboard Setup
This would be an example breadboard setup for the Led example.
![Schematic](extras/breadboard/MSGEQ7_Schematic.png)
![Breadboard Setup](extras/breadboard/MSGEQ7_Breadboard.png)
You have 3 versions you can download:
* The master includes all fixes to the current stable release. Download it by clicking download at the right.
Use the [online Wiki](https://github.com/NicoHood/HID/wiki) to get the newest documentation.
* Download an offline version in [releases](https://github.com/NicoHood/HID/releases).
It's a snapshot of the current stable release but might have missed some updates that the current master branch has included.
This also includes an offline version of the wiki. Offline versions will be available after some time when the official release is out.
* Select [branch 'dev'](https://github.com/NicoHood/HID/tree/dev) to test the bleeding edge of this software. It might now work at all or has a lot of debugging stuff in it.
If the dev version gets near to a new release a note will be placed here, that you can test the new dev beta.
Currently there is no beta available.
Software installation
=====================
Install the library as you are used to.
More information can be found [here](http://arduino.cc/en/guide/libraries).
Wiki
====
All documentation moved to the [wiki page](https://github.com/NicoHood/HID/wiki).
An offline snapshot is available in [releases](https://github.com/NicoHood/HID/releases).
API Documentation
=================
Contact
=======
#####`template <bool smooth, uint8_t resetPin, uint8_t strobePin, uint8_t firstAnalogPin, uint8_t ...analogPins> class CMSGEQ7`
Every CMSGEQ7 instance needs some pins passed via template to optimize the code.
If you want to smooth the readings with the last reading pass true as first argument.
The reset and strobe pin can be anyone on the board.
You can input as many analog pins as needed.
For example as mono mode only a single IC, stereo 2 or surround as many channels as you want.
You can contact me on my wordpress blog in the contact section.
#####`void begin(void);`
Do whatever is required to initialize the IC and resets it.
www.nicohood.de
#####`void end(void);`
Sets pins to input again to safely remove connections if needed
#####`void reset(void);`
Resets IC, so it starts reading at 0 again.
Normally this is not needed since its done in the `begin()` function.
TODO
====
#####`bool read(void);`
Basic read function. Reads all channels and saves value inside the buffer.
You can access the buffer with the `get()` function.
Up to 400FPS are possible with 2 channels I've measured.
Under Construction. This is a todo list for myself.
#####`bool read(const uint32_t currentMicros, const uint32_t interval);`
To automatically read every X seconds you may also use this function.
Use the `ReadsPerSecond(f)` Makro with the interval and you can easily choose a good speed interval.
You can also leave out the first argument, this will be automatically replaced with a `micros()`.
#####`MSGEQ7_data_t get(const uint8_t frequency, const uint8_t channel);`
Returns the data of the selected frequency and channel.
By default this returns an `uint8_t` value, for 10bit resolution `uint16_t`.
Frequency should be 0-6 where 0 is the lowest frequency (Bass) and 6 the highest.
Depending on how many analog pins you have attached you can select the channel here (0-n).
You can also leave out the channel variable to get an average value of all channels.
#####`MSGEQ7_data_t getVolume(uint8_t channel);`
Returns the overall volume of all frequencies of a channel.
By default this returns an `uint8_t` value, for 10bit resolution `uint16_t`.
Depending on how many analog pins you have attached you can select the channel here (0-n).
You can also leave out the channel variable to get an average volume of all channels.
#####`MSGEQ7_data_t map(MSGEQ7_data_t x, MSGEQ7_data_t in_min = MSGEQ7_IN_MIN, MSGEQ7_data_t in_max = MSGEQ7_IN_MAX, MSGEQ7_data_t out_min = MSGEQ7_OUT_MIN, MSGEQ7_data_t out_max = MSGEQ7_OUT_MAX);`
Maps the input from a given input range to an output range.
This is useful to reduce noise. All MSGEQ7 produce a noise of about 15-19 if no music is played.
This macro can be used to remap the input. You can leave out the last 4 arguments, they will be replaced with default values.
For 10 bit resolution the function uses `uint16_t` and 1023 as default maximum value.
#####`Definitions`
```cpp
//#define MSGEQ7_10BIT
#define ReadsPerSecond(f) (1000000UL / (f))
// basic frequencys definitions (0-6 valid, 7 channels)
#define MSGEQ7_0 0
#define MSGEQ7_1 1
#define MSGEQ7_2 2
#define MSGEQ7_3 3
#define MSGEQ7_4 4
#define MSGEQ7_5 5
#define MSGEQ7_6 6
#define MSGEQ7_BASS 0
#define MSGEQ7_LOW 0
#define MSGEQ7_MID 3
#define MSGEQ7_HIGH 5
```
Keyboard Layout for different Languages
Clean up USB Core code from fixed values. Use better understandable definitions
Magic key fix for 32u4?
Check Keyboard keycode function again
Generalize HID key definitions via HIDTables for example?
Breakout Board
==============
The MSGEQ7 Breakout Board lets you easily hook up an audio source or microphone to your microcontroller.
You may also use a 2nd audio output to pass the audio signal to music boxes again.
You can solder a 6 or 8 pin header to the board and connect it to a breadboard for example.
It is fully open source so you can create a copy for yourself or modify it.
#####Features:
* Stereo music analyze
* Audio input via 3.5mm Jack
* Additional audio output
* Additional audio in/output via pin header
* Mounting holes
* Breadboard compatible
* Easy to solder (DIP parts)
* [Open Source Hardware](http://www.oshwa.org/definition/)
#####Required parts:
* 2x [MSGEQ7 IC](https://www.sparkfun.com/products/10468)
* 2x [Audio Jack 3.5mm](https://www.sparkfun.com/products/8032)
* 8 pin header male
* 2x IC socket 8 pins (optional)
* 2x 10nF Capacitor
* 4x 100nF Capacitor
* 2x 33pF Capacitor
* 2x 200k Ohm Resistor
#####Files:
You can find all needed files in the [board](extras/board/) folder.
Click view raw to download the PDF files.
#####Schematic
![Schematic](extras/board/MSGEQ7_Schematic.png)
#####PCB
![PCB](extras/board/MSGEQ7_PCB.png)
Additional Information
======================
This library started as my very first one and become better and better over the time.
To be honest it is now very complex, due to the optimization and API flexibility.
The read function itself is simple though.
Have a look at the library itself, its not so complicated.
But keep attention to the LOW and HIGH setting of strobe and reset
Keep in mind that the smoothed value is created from the last read + current read divided by 2.
I found out that reading with 50 FPS is a good value to use.
You can reset the IC with myMSGEQ7.reset() but you don't need that normally.
If you only want to use mono mode or one IC just connect the two inputs together to the MSGEQ7
and only use one analog input. But you can also use multiply ICs and connect them to an analog input each.
The reset and strobe line is connected to every IC, so you don't need to multiply them.
The output only ranges from 0-255 to save memory use it easier. You don't lose much information.
If you still want to read up to 1023 define MSGEQ7_10BIT before including the library.
The IC has a standard value at about 10-19. You should keep that in mind.
In this case the Led always glims a bit. Have a look at the map() function to improve this.
Test with Android phone (HL1)
improve keywords.txt
```
Version History
===============
```
1.2.1 Release (xx.xx.2015)
* Added 1.6.x library schema
2.4 Release (xx.xx.2015)
* Added Arduino IDE 1.6.6 compatibility with Pluggable HID
* Changed USB-Core into a simple library, only possible with Pluggable HID
* Removed HID presets (like mouse + keyboard + consumer + system)
1.2 Release (23.04.2015)
* Added breakout board files v1.0
* Optimized performance
* Variable number of ICs readable
* Added optional 10bit resolution
* Added more functions/tools
* Improved examples
* Added MSGEQ7_VERSION definition
* Added library.properties
2.3 Release (xx.xx.2015) (never released)
* Updated Libraries
* Updated Arduino Core
* Added Minor Consumer definitions
* Fixed platforms.txt
* SERIAL_RX_BUFFER_SIZE reverted to 16 (TODO add -D to build option)
1.1 Release (10.07.2014)
* Changed syntax
* Optimized performance
* Added more examples
2.2 Release (12.04.2015)
* added experimental, not finished nor documented HID-Bridge between 16u2 and 328/2560
* increased HW Serial1 RX buffer size from 16 to 32 (TX still 16)
* added colour highlighting (through HID-Bridge library)
* removed fixed size in report buffers
* used HID_KeyboardReport_Data_t now in Keyboard API
* Arduino as ISP fix for 328
* Upload verification on USB hubs fix for HL2.0.4
* No USB workaround for Leonardo integrated into variants
* Changed USB Wakeup in System API
* Consumer Key fix (issue #3)
* Gamepad fix (issue #14)
* Added Keycode example
* Mouse press + release fix
1.0 Release (13.04.2014)
* Added general functionality
2.1 Release (28.01.2015)
* Reworked the whole USB-Core from scratch
* Uses less flash if HID or Serial is not used
* Extended and compacter(flash) HID Report Descriptors
* Fixed USB Device Descriptor
* Added u2 compatibility with smaller USB_EP_SIZE (16u2 etc)
* Added Serial Event for LineEncoding and LineState
* Added Serial Function to get dtr state, line encoding etc
* Added Keyboard Led Out report to get Led states (for numlock etc)
* Made CDC-Core independent from USB-Core
* Made HID-Core independent from USB-Core
* Made HID-API independent from HID-Core
* Removed not needed virtual functions in Keyboard
* Made HID Reports and its IDs replaceable via pins_Arduino.h
* Added Absolute Mouse
* Removed uint8_t USBPutChar(uint8_t c); in HID.cpp
* Made void Recv(volatile u8* data, u8 count) in USBCore.cpp static inline
* HID-APIs sends a clean report on begin() and end() now.
* Removed virtual functions in Keyboard API
* Added Keycode functions in Keyboard API
* Inlined a lot of the HID API functions to save flash
* Added Gamepad
* Added RawHID API (but RawHID itself isnt working still)
* Added USB Wakeup support
* Separated USB-Core in its own folder
* Added HID Tables
* USB-Serial now fully reprogrammable
* Easy USB-Core selection via Tools->USB-Core
* Added Arduino as ISP fix for 32u4 and 16u2
* Moved documentation to the wiki
* Added AVR libraries to the core with the better SoftSerial
2.0 Release (29.11.2014)
* Added HoodLoader2
* Separated HoodLoader1&2 more
* Added u2 series for USB-Core
* Extended USB core and fixed minor things for the u2 series
* Added Led Out report.
* Added CDC Line state
* Reworked the whole library structure again
1.8 Beta Release (26.08.2014)
* Changes in the Hoodloader1:
* **Huge improvements**, see Hoodloader1 repository
* Reworked the whole library, easy installation now
* HID fixes for Media Keys/Ubuntu
* Removed Joystick, added 4 Gamepads
1.7.3 Beta Release (10.08.2014)
* Changes in the Hoodloader1:
* Fixed HID flush bug (1.6 - 1.7.2)
1.7.2 Beta Release (10.08.2014)
* Changes in the Hoodloader1:
* Added Lite version for 8u2
* Added Versions that show up as Uno/Mega (not recommended)
* Makefile and structure changes
1.7.1 Beta Release (10.08.2014)
* Changes in the Hoodloader1:
* Fixed HID deactivation bug
1.7 Beta Release (10.08.2014)
* Changes in the Hoodloader1:
* Works as ISP now. See Hoodloader1 Repository for more information.
* Exceeded 8kb limit. For flashing a 8u2 use v1.6 please!
* Changed Readme text
1.6 Beta Release (09.08.2014)
* Bugfixes in the Hoodloader1:
* Changed HID management (not blocking that much, faster)
* added RawHID in/out (HID to Serial)
* Added RawHID Class and example
1.5 Beta Release (21.07.2014)
* Moved Hoodloader1 source to a separate Github page
* Bugfixes in the Hoodloader:
* Firmware is still available here
* Overall a lot of ram improvements, now with a big global union of ram
* Removed USBtoUSART buffer (not needed, saved 128/500 bytes)
* Removed Lite version because of better ram usage not needed
* Separated different modes better to not cause any errors in default mode
* Improved the deactivate option
* Integrated NHP directly
* Replaced LightweightRingbuffer with native Lufa Ringbuffer
* Improved writing to CDC Host
* Fixed a bug in checkNHPProtocol: & needs to be a ==
* General structure changes
* Improved stability
* Fixed Arduino as ISP bug
1.4.1 Beta Release (10.07.2014)
* #define Bugfix in USBAPI.h
1.4 Beta Release (10.07.2014)
* Bugfixes in the Hoodloader1:
* Added Lite Version with less ram usage
* Changed PIDs, edited driver file
* merged v1.0.x and v1.5.x together (both are compatible!)
* added IDE v1.5.7 support
* added Tutorials
1.3 Beta Release (01.07.2014)
* Bugfixes in the Hoodloader1:
* Improved ram usage
* **Important NHP fix inside the HID Class for Uno/Mega**
1.2 Beta Release (22.06.2014)
* Added 1.0.x/1.5.x support
* Bugfixes in the Hoodloader1:
* Sometimes HID Devices weren't updating
when using more than 1 Device (set forcewrite to true)
* Fast updates crashed the bootloader
(too much ram usage, set CDC buffer from 128b to 100b each)
* Minor file structure changes
1.1 Beta Release (05.06.2014)
* Added Leonardo/Micro support
* Included NicoHoodProtocol
* Minor fixes
1.0 Beta Release (03.06.2014)
```
License and Copyright
Licence and Copyright
=====================
If you use this library for any cool project let me know!
```
Copyright (c) 2014-2015 NicoHood
See the readme for credit to other people.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal