My question involves criminal law for the state of: Illinois (chicago)

Hello all!
Let me start out by saying thank you to any one who can give me some input. I am 20 years old by the way.
The other day a couple friends and I went down to the local head shop. We looked around for a little bit and decided to leave after making our purchase. My car was parked accross the street from the shop and we proceeded to it.

Just before we crossed a cop drove by us, turned around at a stop sign, turned off his head lights and looked to be parked. We got into my car and started heading to the highway, we get half a block up a taxi cab brakes hard to pick up some pedestrians, so I brake hard(not that hard in my opinion), I was not following to close or any thing. the next thing I know, I notice the car behind me was the cops that turned around and they are pulling me over. I pull over and get my licence, registration, and Insurance out. the officer walks up to my window I ask him what the problem is and he says that I was "flying", I was not speeding by any means and was probibally under the limit.

The next thing he says is "have you guys been smoking in here tonight" I say no(which was the truth) and he asks me to step out of the vehicle, I asked him "why" and he said "I will explain that out here". So I step out of the car and he begins to frisk me and ask where the weed is at, before I could answer my friends were all being taken out of the car, so I proceeded to tell him where my weed and pipe was(7.5 grams) because I figured he is going to search it anyway. They find my friends weed(above 10), they put us in hand cuffs and take us down to the station.

We were at the station for about two hours while the officers were filling out paperwork. The time came to be transported to another station to get finger printed and get our photos taken. Two new officers arrive to transport us, and just before they take us, they say to the arresting officers where was the probable cause. The arresting officers had forgotten to include my traffic sitation which was the probable cause. So they filled out a traffic ticket for "following too closely" which is not the same reason they told me I was pulled over for, they told me that I was "flying" by which I think they ment speeding.

So here I am getting charged with possession and paraphanelia... I am wondering if there any of this seems unjust? because in my eyes they were going to pull me over as soon as I left the head shop. Is that not profiling?
Also if I can not afford an Lawyer how do I motion to get one?
Thank you again in advance for your help! I am just very nervous, Im a good person, I dont have a mean or bad bone in my body, and I am so frightened by what the out come could be.