Using a cell phone in anything other than "hands-free mode" while driving could soon become illegal in Massachusetts after lawmakers reached a compromise over how to study racial discrimination in traffic stops.

The compromise means both chambers will take final votes this week on a bill to ban cell phones and other electronic devices from being used by drivers.

"It's become a matter of death and destruction," said Sen. Mark Montigny, who has been working with survivors and families who've lost loved ones in crashes to ban electronic devices from drivers' hands for almost 15 years. Montigny admits that "trying to legislate against stupidity doesn't always work," but he says the stiff new $100 fine for being caught on your phone behind the wheel will act as a deterrent.

"It's not going to cause every single person to put their phone down, but most people, once there's an infraction involved and it's clear that there is a law, particularly when there's a surcharge, most people, I think, will think twice before they do it," Montigny told WGBH News.

Fines would increase to $250 for a second offense and to $500 for any additional time a driver is caught by police using a device while in a travel lane beyond turning on a "hands-free" mode.

Legislators had been deadlocked in final negotiations for months, not about electronic devices, but over how to analyze racial data collected from police stops.

The House wanted that data scrubbed of identifying characteristics and studied by a university before making aggregate results public through the Secretary of Public Safety's office. The Senate wanted the public to have access to a much wider array of statistics about who gets pulled over and where.

The compromise orders the Secretary of Public Safety to confidentially transmit police stop data to a university that will release the aggregate results of their study, including age range, gender, race and municipality, but doesn't compromise driver or police identities.

The final compromise between House and Senate negotiators did not satisfy Rahsaan Hall, director of the ACLU of Massachusetts' racial justice program. Hall favored the legislative language passed by the Senate which would have forced collection and reporting on demographic data from all traffic stops, not just the new hands-free violations, and would have opened the information to analysis by the public.

"We want to make sure that we're able to drill down through aggregate data that has been de-identified to make sure that the municipalities where the racial profiling or gender profiling is occurring can be held accountable," Hall said.

Hall characterized a new annual report on discrimination called for in the bill "a step forward", but called restrictions on how the data is collected and shared "two steps back." Hall said there's already enough data to suggest that black and Latino drivers will be pulled over at disproportionately high numbers under the new law.

"With another law on the books that gives law enforcement officers the opportunity to stop and enforce laws, we would expect that we would see additional disparities along the lines of who is being stopped for this new offense," Hall said.

Gov. Charlie Baker is generally supportive of the bill and filed similar legislation himself this year, though the governor has not weighed in on the racial data collection issue or the compromise crafted by a six-member legislative conference committee.